On 6 November 2011 21:35, Grary Stimon <li...@ruby-forum.com> wrote:
> Dave,
>
> Thanks for the consideration you show to this issue of mine, here is the
> recap...
>
> I have the following error from my Rails 3.1 controller...
>
>    JSON::ParserError: unexpected token at 'loan_request=4000000'
>
> ...where the controller code line in question is...
>
>    data = ActiveSupport::JSON.decode(request.body.read)

I can't say that I fully understand what you are doing here but that
does not normally stop me trying to help.  If you break here using
ruby-debug and inspect request.body.read what do you see?

Colin

>
> ...and the ActionController::TestCase test initiation of the error
> was...
>
>    request = 4_000_000
>    post :loan, {:loan_request=>request, :format => :json}
>
> ...finally the test log of the request is...
>
>  Processing by Sec223fAcquisitionController#loan as JSON
>  Parameters: {"loan_request"=>"4000000"}
> Completed 500 Internal Server Error in 28ms
>
>
> What bugs me here is that I don't see the JSON format appear anywhere
> above. I understand why the parser would choke on
> 'loan_request=4000000', because it's not JSON.
>
> Grar
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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.
>
>



-- 
gplus.to/clanlaw

-- 
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.

Reply via email to