bump... On Wed, May 20, 2009 at 3:57 PM, Marc Byrd <dr.marc.b...@gmail.com> wrote:
> Hi, > > I'm using ActiveResource as an API test rig for an API we're developing for > our PHP app - the goal being to validate that we're following some > externally validated conventions for ReSTful API and that we can support at > least one external framework. ;^) I'm open to opinions on the wisdom of > this approach. > > Meanwhile, I'm getting some strange behavior when running from command line > vs. running w/in rails: > > First, from command line: > require 'rubygems' > require 'activesupport' > require 'activeresource' > > class Channel < ActiveResource::Base > self.site = "http://192.168.1.101/" > self.format = :json > end > > c = Channel.find(:all , :params => {:owner => "iamwill"}) > > Result is: > /var/lib/gems/1.8/gems/activesupport-2.3.2/lib/active_support/json/decoding.rb:14:in > `decode': Invalid JSON string (ActiveSupport::JSON::ParseError) > from > /var/lib/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/formats/json_format.rb:19:in > `decode' > from > /var/lib/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/connection.rb:116:in > `get' > from > /var/lib/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/base.rb:576:in > `find_every' > from > /var/lib/gems/1.8/gems/activeresource-2.3.2/lib/active_resource/base.rb:519:in > `find' > from channels.rb:10 > > But when I run from rails, it parses no problem. > > I gave the rails version malformed json to cause it to choke to figure out > the difference: > > vendor/rails/activesupport/lib/active_support/json/decoding.rb:14:in `decode' > > > Is it possible to coerce the non-rails version to use the rails json > parser? Why are there two different versions? > > Thanks, > > > m > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---