Friendly looks pretty sweet. Trying to get it working with my app but I'm
running into some problems doing a simple create. Running on rails 2.3.4.
Am I doing something wrong?
class UserInfo
include Friendly::Document
attribute :name, String
end
ruby-1.8.6-p383 > ui = UserInfo.create
NoMethodError: undefined method `[]' for
#<JSON::Pure::Generator::State:0x105a829f0>
from
/Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in
`as_json'
from
/Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in
`to_json'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in
`generate'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in
`serialize'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in
`to_record'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in
`create'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in
`create'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in
`each_store'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in
`each'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in
`each_store'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in
`create'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in
`save'
from
/Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in
`create'
from (irb):14
from :0
Thanks,
Justin
I'm no expert but it looks like you needs to pass some arguments to the 'create' method. If you don't want to pass arguments on that line of code, try calling UserInfo.new. Let me know how that works! Good luck. On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen <justin.h.chen@gmail.com>wrote: > Friendly looks pretty sweet. Trying to get it working with my app but I'm > running into some problems doing a simple create. Running on rails 2.3.4. > Am I doing something wrong? > > class UserInfo > include Friendly::Document > attribute :name, String > end > > ruby-1.8.6-p383 > ui = UserInfo.create > NoMethodError: undefined method `[]' for > #<JSON::Pure::Generator::State:0x105a829f0> > from > /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in > `as_json' > from > /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in > `to_json' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in > `generate' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in > `serialize' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in > `to_record' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in > `create' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in > `create' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in > `each_store' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in > `each' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in > `each_store' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in > `create' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in > `save' > from > /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in > `create' > from (irb):14 > from :0 > > Thanks, > Justin >
I tried UserInfo.new then save and also UserInfo.create(:name => 'bob') but they both give the same error. If I find that as_json method in activesupport and comment it out, it actually works. I'm not sure where the collision is coming from though. Justin On Wed, Jan 6, 2010 at 7:58 PM, Alan deLevie <adelevie@gmail.com> wrote: > I'm no expert but it looks like you needs to pass some arguments to the > 'create' method. If you don't want to pass arguments on that line of code, > try calling UserInfo.new. Let me know how that works! Good luck. > > > On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen <justin.h.chen@gmail.com>wrote: > >> Friendly looks pretty sweet. Trying to get it working with my app but I'm >> running into some problems doing a simple create. Running on rails 2.3.4. >> Am I doing something wrong? >> >> class UserInfo >> include Friendly::Document >> attribute :name, String >> end >> >> ruby-1.8.6-p383 > ui = UserInfo.create >> NoMethodError: undefined method `[]' for >> #<JSON::Pure::Generator::State:0x105a829f0> >> from >> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in >> `as_json' >> from >> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in >> `to_json' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in >> `generate' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in >> `serialize' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in >> `to_record' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in >> `create' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >> `create' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >> `each_store' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >> `each' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >> `each_store' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >> `create' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in >> `save' >> from >> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in >> `create' >> from (irb):14 >> from :0 >> >> Thanks, >> Justin >> > >
This is something to do with activesupport stepping on to_json methods. Which version of active_support do you have vendored? - James On Wed, Jan 6, 2010 at 8:03 PM, Justin Chen <justin.h.chen@gmail.com> wrote: > I tried UserInfo.new then save and also UserInfo.create(:name => 'bob') but > they both give the same error. > > If I find that as_json method in activesupport and comment it out, it > actually works. I'm not sure where the collision is coming from though. > > Justin > > > On Wed, Jan 6, 2010 at 7:58 PM, Alan deLevie <adelevie@gmail.com> wrote: > >> I'm no expert but it looks like you needs to pass some arguments to the >> 'create' method. If you don't want to pass arguments on that line of code, >> try calling UserInfo.new. Let me know how that works! Good luck. >> >> >> On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >> >>> Friendly looks pretty sweet. Trying to get it working with my app but >>> I'm running into some problems doing a simple create. Running on rails >>> 2.3.4. Am I doing something wrong? >>> >>> class UserInfo >>> include Friendly::Document >>> attribute :name, String >>> end >>> >>> ruby-1.8.6-p383 > ui = UserInfo.create >>> NoMethodError: undefined method `[]' for >>> #<JSON::Pure::Generator::State:0x105a829f0> >>> from >>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in >>> `as_json' >>> from >>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in >>> `to_json' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in >>> `generate' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in >>> `serialize' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in >>> `to_record' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in >>> `create' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>> `create' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>> `each_store' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>> `each' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>> `each_store' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>> `create' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in >>> `save' >>> from >>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in >>> `create' >>> from (irb):14 >>> from :0 >>> >>> Thanks, >>> Justin >>> >> >> >
Yeah, that's what it seems like. I'm on 2.3.4. On Wed, Jan 6, 2010 at 10:46 PM, James Golick <jamesgolick@gmail.com> wrote: > This is something to do with activesupport stepping on to_json methods. > > Which version of active_support do you have vendored? > > - James > > > On Wed, Jan 6, 2010 at 8:03 PM, Justin Chen <justin.h.chen@gmail.com>wrote: > >> I tried UserInfo.new then save and also UserInfo.create(:name => 'bob') >> but they both give the same error. >> >> If I find that as_json method in activesupport and comment it out, it >> actually works. I'm not sure where the collision is coming from though. >> >> Justin >> >> >> On Wed, Jan 6, 2010 at 7:58 PM, Alan deLevie <adelevie@gmail.com> wrote: >> >>> I'm no expert but it looks like you needs to pass some arguments to the >>> 'create' method. If you don't want to pass arguments on that line of code, >>> try calling UserInfo.new. Let me know how that works! Good luck. >>> >>> >>> On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>> >>>> Friendly looks pretty sweet. Trying to get it working with my app but >>>> I'm running into some problems doing a simple create. Running on rails >>>> 2.3.4. Am I doing something wrong? >>>> >>>> class UserInfo >>>> include Friendly::Document >>>> attribute :name, String >>>> end >>>> >>>> ruby-1.8.6-p383 > ui = UserInfo.create >>>> NoMethodError: undefined method `[]' for >>>> #<JSON::Pure::Generator::State:0x105a829f0> >>>> from >>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in >>>> `as_json' >>>> from >>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in >>>> `to_json' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in >>>> `generate' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in >>>> `serialize' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in >>>> `to_record' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in >>>> `create' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>> `create' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>> `each_store' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>> `each' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>> `each_store' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>> `create' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in >>>> `save' >>>> from >>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in >>>> `create' >>>> from (irb):14 >>>> from :0 >>>> >>>> Thanks, >>>> Justin >>>> >>> >>> >> >
Me too. Which version of the json gem is installed? On Wed, Jan 6, 2010 at 10:57 PM, Justin Chen <justin.h.chen@gmail.com>wrote: > Yeah, that's what it seems like. I'm on 2.3.4. > > > On Wed, Jan 6, 2010 at 10:46 PM, James Golick <jamesgolick@gmail.com>wrote: > >> This is something to do with activesupport stepping on to_json methods. >> >> Which version of active_support do you have vendored? >> >> - James >> >> >> On Wed, Jan 6, 2010 at 8:03 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >> >>> I tried UserInfo.new then save and also UserInfo.create(:name => 'bob') >>> but they both give the same error. >>> >>> If I find that as_json method in activesupport and comment it out, it >>> actually works. I'm not sure where the collision is coming from though. >>> >>> Justin >>> >>> >>> On Wed, Jan 6, 2010 at 7:58 PM, Alan deLevie <adelevie@gmail.com> wrote: >>> >>>> I'm no expert but it looks like you needs to pass some arguments to the >>>> 'create' method. If you don't want to pass arguments on that line of code, >>>> try calling UserInfo.new. Let me know how that works! Good luck. >>>> >>>> >>>> On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>>> >>>>> Friendly looks pretty sweet. Trying to get it working with my app but >>>>> I'm running into some problems doing a simple create. Running on rails >>>>> 2.3.4. Am I doing something wrong? >>>>> >>>>> class UserInfo >>>>> include Friendly::Document >>>>> attribute :name, String >>>>> end >>>>> >>>>> ruby-1.8.6-p383 > ui = UserInfo.create >>>>> NoMethodError: undefined method `[]' for >>>>> #<JSON::Pure::Generator::State:0x105a829f0> >>>>> from >>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in >>>>> `as_json' >>>>> from >>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in >>>>> `to_json' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in >>>>> `generate' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in >>>>> `serialize' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in >>>>> `to_record' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in >>>>> `create' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>> `create' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>> `each_store' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>> `each' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>> `each_store' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>> `create' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in >>>>> `save' >>>>> from >>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in >>>>> `create' >>>>> from (irb):14 >>>>> from :0 >>>>> >>>>> Thanks, >>>>> Justin >>>>> >>>> >>>> >>> >> >
json_pure (1.2.0) On Thu, Jan 7, 2010 at 8:46 AM, James Golick <jamesgolick@gmail.com> wrote: > Me too. Which version of the json gem is installed? > > > On Wed, Jan 6, 2010 at 10:57 PM, Justin Chen <justin.h.chen@gmail.com>wrote: > >> Yeah, that's what it seems like. I'm on 2.3.4. >> >> >> On Wed, Jan 6, 2010 at 10:46 PM, James Golick <jamesgolick@gmail.com>wrote: >> >>> This is something to do with activesupport stepping on to_json methods. >>> >>> Which version of active_support do you have vendored? >>> >>> - James >>> >>> >>> On Wed, Jan 6, 2010 at 8:03 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>> >>>> I tried UserInfo.new then save and also UserInfo.create(:name => 'bob') >>>> but they both give the same error. >>>> >>>> If I find that as_json method in activesupport and comment it out, it >>>> actually works. I'm not sure where the collision is coming from though. >>>> >>>> Justin >>>> >>>> >>>> On Wed, Jan 6, 2010 at 7:58 PM, Alan deLevie <adelevie@gmail.com>wrote: >>>> >>>>> I'm no expert but it looks like you needs to pass some arguments to the >>>>> 'create' method. If you don't want to pass arguments on that line of code, >>>>> try calling UserInfo.new. Let me know how that works! Good luck. >>>>> >>>>> >>>>> On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>>>> >>>>>> Friendly looks pretty sweet. Trying to get it working with my app but >>>>>> I'm running into some problems doing a simple create. Running on rails >>>>>> 2.3.4. Am I doing something wrong? >>>>>> >>>>>> class UserInfo >>>>>> include Friendly::Document >>>>>> attribute :name, String >>>>>> end >>>>>> >>>>>> ruby-1.8.6-p383 > ui = UserInfo.create >>>>>> NoMethodError: undefined method `[]' for >>>>>> #<JSON::Pure::Generator::State:0x105a829f0> >>>>>> from >>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in >>>>>> `as_json' >>>>>> from >>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in >>>>>> `to_json' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in >>>>>> `generate' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in >>>>>> `serialize' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in >>>>>> `to_record' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in >>>>>> `create' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>> `create' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>> `each_store' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>> `each' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>> `each_store' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>> `create' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in >>>>>> `save' >>>>>> from >>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in >>>>>> `create' >>>>>> from (irb):14 >>>>>> from :0 >>>>>> >>>>>> Thanks, >>>>>> Justin >>>>>> >>>>> >>>>> >>>> >>> >> >
Hmm... can you try installing the json gem? Or are you on jruby? On Thu, Jan 7, 2010 at 9:07 AM, Justin Chen <justin.h.chen@gmail.com> wrote: > json_pure (1.2.0) > > On Thu, Jan 7, 2010 at 8:46 AM, James Golick <jamesgolick@gmail.com>wrote: > >> Me too. Which version of the json gem is installed? >> >> >> On Wed, Jan 6, 2010 at 10:57 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >> >>> Yeah, that's what it seems like. I'm on 2.3.4. >>> >>> >>> On Wed, Jan 6, 2010 at 10:46 PM, James Golick <jamesgolick@gmail.com>wrote: >>> >>>> This is something to do with activesupport stepping on to_json methods. >>>> >>>> Which version of active_support do you have vendored? >>>> >>>> - James >>>> >>>> >>>> On Wed, Jan 6, 2010 at 8:03 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>>> >>>>> I tried UserInfo.new then save and also UserInfo.create(:name => 'bob') >>>>> but they both give the same error. >>>>> >>>>> If I find that as_json method in activesupport and comment it out, it >>>>> actually works. I'm not sure where the collision is coming from though. >>>>> >>>>> Justin >>>>> >>>>> >>>>> On Wed, Jan 6, 2010 at 7:58 PM, Alan deLevie <adelevie@gmail.com>wrote: >>>>> >>>>>> I'm no expert but it looks like you needs to pass some arguments to >>>>>> the 'create' method. If you don't want to pass arguments on that line of >>>>>> code, try calling UserInfo.new. Let me know how that works! Good luck. >>>>>> >>>>>> >>>>>> On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen <justin.h.chen@gmail.com >>>>>> > wrote: >>>>>> >>>>>>> Friendly looks pretty sweet. Trying to get it working with my app >>>>>>> but I'm running into some problems doing a simple create. Running on rails >>>>>>> 2.3.4. Am I doing something wrong? >>>>>>> >>>>>>> class UserInfo >>>>>>> include Friendly::Document >>>>>>> attribute :name, String >>>>>>> end >>>>>>> >>>>>>> ruby-1.8.6-p383 > ui = UserInfo.create >>>>>>> NoMethodError: undefined method `[]' for >>>>>>> #<JSON::Pure::Generator::State:0x105a829f0> >>>>>>> from >>>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in >>>>>>> `as_json' >>>>>>> from >>>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in >>>>>>> `to_json' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in >>>>>>> `generate' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in >>>>>>> `serialize' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in >>>>>>> `to_record' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in >>>>>>> `create' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>>> `create' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>> `each_store' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>> `each' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>> `each_store' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>>> `create' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in >>>>>>> `save' >>>>>>> from >>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in >>>>>>> `create' >>>>>>> from (irb):14 >>>>>>> from :0 >>>>>>> >>>>>>> Thanks, >>>>>>> Justin >>>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >> >
Installing the json gem worked. Do I still need json_pure? On Thu, Jan 7, 2010 at 9:16 AM, James Golick <jamesgolick@gmail.com> wrote: > Hmm... can you try installing the json gem? Or are you on jruby? > > > On Thu, Jan 7, 2010 at 9:07 AM, Justin Chen <justin.h.chen@gmail.com>wrote: > >> json_pure (1.2.0) >> >> On Thu, Jan 7, 2010 at 8:46 AM, James Golick <jamesgolick@gmail.com>wrote: >> >>> Me too. Which version of the json gem is installed? >>> >>> >>> On Wed, Jan 6, 2010 at 10:57 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>> >>>> Yeah, that's what it seems like. I'm on 2.3.4. >>>> >>>> >>>> On Wed, Jan 6, 2010 at 10:46 PM, James Golick <jamesgolick@gmail.com>wrote: >>>> >>>>> This is something to do with activesupport stepping on to_json methods. >>>>> >>>>> Which version of active_support do you have vendored? >>>>> >>>>> - James >>>>> >>>>> >>>>> On Wed, Jan 6, 2010 at 8:03 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>>>> >>>>>> I tried UserInfo.new then save and also UserInfo.create(:name => >>>>>> 'bob') but they both give the same error. >>>>>> >>>>>> If I find that as_json method in activesupport and comment it out, it >>>>>> actually works. I'm not sure where the collision is coming from though. >>>>>> >>>>>> Justin >>>>>> >>>>>> >>>>>> On Wed, Jan 6, 2010 at 7:58 PM, Alan deLevie <adelevie@gmail.com>wrote: >>>>>> >>>>>>> I'm no expert but it looks like you needs to pass some arguments to >>>>>>> the 'create' method. If you don't want to pass arguments on that line of >>>>>>> code, try calling UserInfo.new. Let me know how that works! Good luck. >>>>>>> >>>>>>> >>>>>>> On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen < >>>>>>> justin.h.chen@gmail.com> wrote: >>>>>>> >>>>>>>> Friendly looks pretty sweet. Trying to get it working with my app >>>>>>>> but I'm running into some problems doing a simple create. Running on rails >>>>>>>> 2.3.4. Am I doing something wrong? >>>>>>>> >>>>>>>> class UserInfo >>>>>>>> include Friendly::Document >>>>>>>> attribute :name, String >>>>>>>> end >>>>>>>> >>>>>>>> ruby-1.8.6-p383 > ui = UserInfo.create >>>>>>>> NoMethodError: undefined method `[]' for >>>>>>>> #<JSON::Pure::Generator::State:0x105a829f0> >>>>>>>> from >>>>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in >>>>>>>> `as_json' >>>>>>>> from >>>>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in >>>>>>>> `to_json' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in >>>>>>>> `generate' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in >>>>>>>> `serialize' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in >>>>>>>> `to_record' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in >>>>>>>> `create' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>>>> `create' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>>> `each_store' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>>> `each' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>>> `each_store' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>>>> `create' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in >>>>>>>> `save' >>>>>>>> from >>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in >>>>>>>> `create' >>>>>>>> from (irb):14 >>>>>>>> from :0 >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Justin >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
No, probably not. I'll have to switch the gem dependency back. - J. On Thu, Jan 7, 2010 at 12:13 PM, Justin Chen <justin.h.chen@gmail.com>wrote: > Installing the json gem worked. Do I still need json_pure? > > > On Thu, Jan 7, 2010 at 9:16 AM, James Golick <jamesgolick@gmail.com>wrote: > >> Hmm... can you try installing the json gem? Or are you on jruby? >> >> >> On Thu, Jan 7, 2010 at 9:07 AM, Justin Chen <justin.h.chen@gmail.com>wrote: >> >>> json_pure (1.2.0) >>> >>> On Thu, Jan 7, 2010 at 8:46 AM, James Golick <jamesgolick@gmail.com>wrote: >>> >>>> Me too. Which version of the json gem is installed? >>>> >>>> >>>> On Wed, Jan 6, 2010 at 10:57 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>>> >>>>> Yeah, that's what it seems like. I'm on 2.3.4. >>>>> >>>>> >>>>> On Wed, Jan 6, 2010 at 10:46 PM, James Golick <jamesgolick@gmail.com>wrote: >>>>> >>>>>> This is something to do with activesupport stepping on to_json >>>>>> methods. >>>>>> >>>>>> Which version of active_support do you have vendored? >>>>>> >>>>>> - James >>>>>> >>>>>> >>>>>> On Wed, Jan 6, 2010 at 8:03 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>>>>> >>>>>>> I tried UserInfo.new then save and also UserInfo.create(:name => >>>>>>> 'bob') but they both give the same error. >>>>>>> >>>>>>> If I find that as_json method in activesupport and comment it out, it >>>>>>> actually works. I'm not sure where the collision is coming from though. >>>>>>> >>>>>>> Justin >>>>>>> >>>>>>> >>>>>>> On Wed, Jan 6, 2010 at 7:58 PM, Alan deLevie <adelevie@gmail.com>wrote: >>>>>>> >>>>>>>> I'm no expert but it looks like you needs to pass some arguments to >>>>>>>> the 'create' method. If you don't want to pass arguments on that line of >>>>>>>> code, try calling UserInfo.new. Let me know how that works! Good luck. >>>>>>>> >>>>>>>> >>>>>>>> On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen < >>>>>>>> justin.h.chen@gmail.com> wrote: >>>>>>>> >>>>>>>>> Friendly looks pretty sweet. Trying to get it working with my app >>>>>>>>> but I'm running into some problems doing a simple create. Running on rails >>>>>>>>> 2.3.4. Am I doing something wrong? >>>>>>>>> >>>>>>>>> class UserInfo >>>>>>>>> include Friendly::Document >>>>>>>>> attribute :name, String >>>>>>>>> end >>>>>>>>> >>>>>>>>> ruby-1.8.6-p383 > ui = UserInfo.create >>>>>>>>> NoMethodError: undefined method `[]' for >>>>>>>>> #<JSON::Pure::Generator::State:0x105a829f0> >>>>>>>>> from >>>>>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in >>>>>>>>> `as_json' >>>>>>>>> from >>>>>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in >>>>>>>>> `to_json' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in >>>>>>>>> `generate' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in >>>>>>>>> `serialize' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in >>>>>>>>> `to_record' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in >>>>>>>>> `create' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>>>>> `create' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>>>> `each_store' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>>>> `each' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>>>> `each_store' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>>>>> `create' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in >>>>>>>>> `save' >>>>>>>>> from >>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in >>>>>>>>> `create' >>>>>>>>> from (irb):14 >>>>>>>>> from :0 >>>>>>>>> >>>>>>>>> Thanks, >>>>>>>>> Justin >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
Ok, cool. Thanks for the help! Justin On Fri, Jan 8, 2010 at 8:49 AM, James Golick <jamesgolick@gmail.com> wrote: > No, probably not. I'll have to switch the gem dependency back. > > - J. > > > On Thu, Jan 7, 2010 at 12:13 PM, Justin Chen <justin.h.chen@gmail.com>wrote: > >> Installing the json gem worked. Do I still need json_pure? >> >> >> On Thu, Jan 7, 2010 at 9:16 AM, James Golick <jamesgolick@gmail.com>wrote: >> >>> Hmm... can you try installing the json gem? Or are you on jruby? >>> >>> >>> On Thu, Jan 7, 2010 at 9:07 AM, Justin Chen <justin.h.chen@gmail.com>wrote: >>> >>>> json_pure (1.2.0) >>>> >>>> On Thu, Jan 7, 2010 at 8:46 AM, James Golick <jamesgolick@gmail.com>wrote: >>>> >>>>> Me too. Which version of the json gem is installed? >>>>> >>>>> >>>>> On Wed, Jan 6, 2010 at 10:57 PM, Justin Chen <justin.h.chen@gmail.com>wrote: >>>>> >>>>>> Yeah, that's what it seems like. I'm on 2.3.4. >>>>>> >>>>>> >>>>>> On Wed, Jan 6, 2010 at 10:46 PM, James Golick <jamesgolick@gmail.com>wrote: >>>>>> >>>>>>> This is something to do with activesupport stepping on to_json >>>>>>> methods. >>>>>>> >>>>>>> Which version of active_support do you have vendored? >>>>>>> >>>>>>> - James >>>>>>> >>>>>>> >>>>>>> On Wed, Jan 6, 2010 at 8:03 PM, Justin Chen <justin.h.chen@gmail.com >>>>>>> > wrote: >>>>>>> >>>>>>>> I tried UserInfo.new then save and also UserInfo.create(:name => >>>>>>>> 'bob') but they both give the same error. >>>>>>>> >>>>>>>> If I find that as_json method in activesupport and comment it out, >>>>>>>> it actually works. I'm not sure where the collision is coming from though. >>>>>>>> >>>>>>>> Justin >>>>>>>> >>>>>>>> >>>>>>>> On Wed, Jan 6, 2010 at 7:58 PM, Alan deLevie <adelevie@gmail.com>wrote: >>>>>>>> >>>>>>>>> I'm no expert but it looks like you needs to pass some arguments to >>>>>>>>> the 'create' method. If you don't want to pass arguments on that line of >>>>>>>>> code, try calling UserInfo.new. Let me know how that works! Good luck. >>>>>>>>> >>>>>>>>> >>>>>>>>> On Wed, Jan 6, 2010 at 10:55 PM, Justin Chen < >>>>>>>>> justin.h.chen@gmail.com> wrote: >>>>>>>>> >>>>>>>>>> Friendly looks pretty sweet. Trying to get it working with my app >>>>>>>>>> but I'm running into some problems doing a simple create. Running on rails >>>>>>>>>> 2.3.4. Am I doing something wrong? >>>>>>>>>> >>>>>>>>>> class UserInfo >>>>>>>>>> include Friendly::Document >>>>>>>>>> attribute :name, String >>>>>>>>>> end >>>>>>>>>> >>>>>>>>>> ruby-1.8.6-p383 > ui = UserInfo.create >>>>>>>>>> NoMethodError: undefined method `[]' for >>>>>>>>>> #<JSON::Pure::Generator::State:0x105a829f0> >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:45:in >>>>>>>>>> `as_json' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/Sites/mm/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb:34:in >>>>>>>>>> `to_json' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/json_pure-1.2.0/lib/json/common.rb:183:in >>>>>>>>>> `generate' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:28:in >>>>>>>>>> `serialize' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/translator.rb:22:in >>>>>>>>>> `to_record' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document_table.rb:22:in >>>>>>>>>> `create' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>>>>>> `create' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>>>>> `each_store' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>>>>> `each' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:72:in >>>>>>>>>> `each_store' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/storage_proxy.rb:47:in >>>>>>>>>> `create' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:206:in >>>>>>>>>> `save' >>>>>>>>>> from >>>>>>>>>> /Users/justinchen/.rvm/gems/ruby/1.8.6/gems/friendly-0.4.3/lib/friendly/document.rb:93:in >>>>>>>>>> `create' >>>>>>>>>> from (irb):14 >>>>>>>>>> from :0 >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> Justin >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >