AWS and passing in a Model


#1

Hi,

I have a webservice. And I want to pass in, a model.
So, for example:

api_method :save_person, :expects => [Person]

When I do this I get an error saying that I cannot have ActiveRecord
objects as parameters. Fine. I can have AWS Structs as parameters. I
don’t want to start ‘maintaining’ a struct everytime I change the table
structure od Persons.

So, is there an elegant way to ‘port’ my ActiveRecod Person to my Struct
Person, or, is there another way to make use of my ActiveRecord Person
to be able to pass it in as a parameter to my webservice method?

Thanks
Joerg


#2

Joerg,

Try this:
ActionWebService::API::Base.allow_active_record_expects = true

The reason for the option is in the CHANGELOG for ActionWebService:
Add ActionWebService::API::Base.allow_active_record_expects option,
with a default of false. Setting this to true will allow specifying
ActiveRecord::Base model classes in :expects. API writers should take
care to validate the received ActiveRecord model objects when turning
it on, and/or have an authentication mechanism in place to reduce the
security risk.

Cody

On 1/20/06, Joerg D. removed_email_address@domain.invalid wrote:

structure od Persons.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


http://www.codyfauser.com


#3

Ah great - thanks for your help.

Cody F. wrote:

Joerg,

Try this:
ActionWebService::API::Base.allow_active_record_expects = true

The reason for the option is in the CHANGELOG for ActionWebService:
Add ActionWebService::API::Base.allow_active_record_expects option,
with a default of false. Setting this to true will allow specifying