-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot bulk assign an association as an object #1
Comments
Hmm, weird. Looking at your backtrace, it seems to think that current_user is an Array. |
For a quick fix try: ??? |
or: |
The quick fix I went for was more like: c = CoolResource.new |
Cool. Good to know there's at least a workaround. could you try: just to be sure it's not something weird coming out of current_user ??? I've had a go at it myself and I can say that using "find" it seems to work for me... but then I had to hack together a fake HyRes object. In my case my CoolResource has_one :user |
Bulk assigning an object as an association fails.
For example:
CoolResource.new(:owner => current_user)
raises:ArgumentError: expected an attributes Hash, got #User:...
activeresource/lib/active_resource/base.rb:750:in 'load'
activeresource/lib/active_resource/base.rb:521:in 'initialize'
hyperactive_resource/lib/hyperactive_resource.rb:338:in 'new'
hyperactive_resource/lib/hyperactive_resource.rb:338:in 'load_array'
hyperactive_resource/lib/hyperactive_resource.rb:338:in 'map'
hyperactive_resource/lib/hyperactive_resource.rb:338:in 'load_array'
hyperactive_resource/lib/hyperactive_resource.rb:308:in 'load'
hyperactive_resource/lib/hyperactive_resource.rb:303:in 'each'
hyperactive_resource/lib/hyperactive_resource.rb:303:in 'load'
hyperactive_resource/lib/hyperactive_resource.rb:14:in 'initialize'
The text was updated successfully, but these errors were encountered: