# AWS and passing in a Model

**URL:** <https://www.ruby-forum.com/t/aws-and-passing-in-a-model/52917>\
**Category:** Rails\
**Created:** [January 20, 2006, 10:06am UTC](https://www.ruby-forum.com/t/aws-and-passing-in-a-model/52917 "2006-01-20T10:06:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joergd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@joergd](https://www.ruby-forum.com/u/joergd)\
**Post date:** [January 20, 2006, 10:06am UTC](https://www.ruby-forum.com/t/aws-and-passing-in-a-model/52917/1 "2006-01-20T10:06:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joergd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@joergd](https://www.ruby-forum.com/u/joergd)\
**Post date:** [January 20, 2006, 6:05pm UTC](https://www.ruby-forum.com/t/aws-and-passing-in-a-model/52917/2 "2006-01-20T18:05:31Z")

</div>

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](mailto: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://lists.rubyonrails.org/mailman/listinfo/rails)

–  
[http://www.codyfauser.com](http://www.codyfauser.com)

---

<div class="post-metadata">

**Author:** ![joergd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@joergd](https://www.ruby-forum.com/u/joergd)\
**Post date:** [January 20, 2006, 10:34pm UTC](https://www.ruby-forum.com/t/aws-and-passing-in-a-model/52917/3 "2006-01-20T22:34:18Z")

</div>

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
