Correct me if I''m wrong, but if a callback is specified for render :json, the response is no longer json - it''s javascript. Shouldn''t the content type be set accordingly? I''m experimenting with modifying the javascript response in an after_filter - for instance, I might append something along the lines of "Flash.show(#{flash[:notice]})" to display a flash regardless of whether the request was ajaxy or not. I could do the same with json by adding a ''flash'' property to the json object, but only if I could be sure that the response really is pure json... hence this post. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Mislav Marohnić
2007-Apr-13 10:34 UTC
Re: render :json with a callback shouldn''t be Mime::JSON...
On 4/12/07, Jon <jdelStrother@gmail.com> wrote:> > > Correct me if I''m wrong, but if a callback is specified for > render :json, the response is no longer json - it''s javascript. > Shouldn''t the content type be set accordingly?test: http://dev.rubyonrails.org/browser/trunk/actionpack/test/controller/render_test.rb?r=6517#L196 You''re right. JSON with a callback is no longer valid JSON, as far as I know. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 13, 11:34 am, "Mislav Marohnić" <mislav.maroh...@gmail.com> wrote:> On 4/12/07, Jon <jdelStrot...@gmail.com> wrote: > > > > > Correct me if I''m wrong, but if a callback is specified for > > render :json, the response is no longer json - it''s javascript. > > Shouldn''t the content type be set accordingly? > > test:http://dev.rubyonrails.org/browser/trunk/actionpack/test/controller/r... > > You''re right. JSON with a callback is no longer valid JSON, as far as I > know.Well, based on the 100% agreement rating so far, here''s a patch: http://dev.rubyonrails.org/ticket/8062 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Mislav Marohnić
2007-Apr-13 14:36 UTC
Re: render :json with a callback shouldn''t be Mime::JSON...
On 4/13/07, Jon <jdelStrother@gmail.com> wrote:> > > Well, based on the 100% agreement rating so far, here''s a patch: > http://dev.rubyonrails.org/ticket/8062Awesome - a swift consensus ;) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---