posting Nested Attributes causes ArgumentError

58 views
Skip to first unread message

acras

unread,
Apr 24, 2011, 7:55:59 PM4/24/11
to restfulx-framework
I have a model Dimension wich has_many DimensionValue.

has_many :dimension_values
accepts_nested_attributes_for :dimension_values, :allow_destroy =>
true

In my flex app

[Lazy]
[HasMany]
public var dimensionValues:ModelsCollection;

When I try to update or create a record rails throws an exception

ArgumentError (Hash or Array expected, got String...

What it seems to me is that restfulx is not "translating" the params
from the flex representation to post correctly to rails.

I´m pretty sure I am doing something wrong, but have no idea where to
search.

Thanks
Ricardo

acras

unread,
Apr 24, 2011, 9:21:07 PM4/24/11
to restfulx-framework
Some context

restfulx-framework 1.2.4
flex 3

Thanks

acras

unread,
Apr 25, 2011, 10:42:38 AM4/25/11
to restfulx-framework
Further investigation shows that the issue was in the rails end. I´m
using the rails 3 version of the restfulx. Applying a before_filter
and making a params["dimension"]["dimension_values_attributes"] =
JSON.parse(params["dimension"]["dimension_values_attributes"]) makes
it work.

Is this an issue with restfulx?

Thanks

Dima Berastau

unread,
Apr 25, 2011, 7:40:17 PM4/25/11
to restfulx-...@googlegroups.com
Hi,

You are probably missing restfulx.rb initializer in your Rails app. BTW, what version of Rails are you using?

If it's Rails 2, then please refer to http://dima.github.com/2009/07/17/whats-new-in-restfulx-1.2.3.html and make sure you have config/initializers/restfulx.rb that looks similar to what is described in that doc. Or have a look at a sample restfulx.rb initializer here: https://github.com/dima/pomodo_on_rails/blob/master/config/initializers/restfulx.rb

If it's Rails 3 unfortunately there's still a bunch of generators that are not ported (I lack the time at the moment and haven't had anyone volunteer to help with those), so not *ALL* functionality is available.

Hope that helps,
Dima

--
You received this message because you are subscribed to the Google Groups "restfulx-framework" group.
To post to this group, send email to restfulx-...@googlegroups.com.
To unsubscribe from this group, send email to restfulx-framew...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/restfulx-framework?hl=en.


Dima Berastau

unread,
Apr 25, 2011, 7:41:28 PM4/25/11
to restfulx-...@googlegroups.com
Hi,

It is an issue with rails 3 version of restfulx, yes. The port from Rails 2 is still incomplete.

Dima

Reply all
Reply to author
Forward
0 new messages