Topic: Error while creating ActiveResource
I have a simple active resource class.
class Example < ActiveResource::Base
self.site = "http://www.example.com"
endWhen I try to create a instance of this active resource similar to
e = Example.new(:files => [{:name => "name", :revision => 0}]) I'm getting the following error.
TypeError: can't convert Hash into String
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activeresource-3.0.17/lib/active_resource/base.rb:1232:in `initialize'
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activeresource-3.0.17/lib/active_resource/base.rb:1232:in `new'
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activeresource-3.0.17/lib/active_resource/base.rb:1232:in `block (2 levels) in load'
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activeresource-3.0.17/lib/active_resource/base.rb:1230:in `map'
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activeresource-3.0.17/lib/active_resource/base.rb:1230:in `block in load'
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activeresource-3.0.17/lib/active_resource/base.rb:1224:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activeresource-3.0.17/lib/active_resource/base.rb:1224:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/activeresource-3.0.17/lib/active_resource/base.rb:969:in `initialize'
from (irb):16:in `new'If i change the name of the attribute, say fileset instead of files, I'm able to create an instance.
This was working fine in Rails 2.3 & ruby 1.8.7 and i'm porting my application to Rails 3.0.17 & ruby 1.9.3p327.
Can someone please help me in debugging this.