Forum: Ruby on Rails AWS and passing in a Model

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joerg D. (Guest)
on 2006-01-20 11:06
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
Cody F. (Guest)
on 2006-01-20 19:05
(Received via mailing list)
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
Joerg D. (Guest)
on 2006-01-20 23:34
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
This topic is locked and can not be replied to.