On Aug 17, 1:59 am, Cainus <[email protected]> wrote: > Hey all... I'm building a RESTful JSON API and I find myself writing > this: > > JSON.parse(request.body.read) > > ...over and over in every controller action that accepts JSON in the > request body (which is a lot of actions). > > Does rails have a better built-in way to keep the code more DRY? Or > should I solve that somehow myself? >
If the content-type is set properly on the request, rails should populate params with the parsed json itself. Fred > Thanks, > > Cainus -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

