I just created a new rails app to test this out, using edge rails. I have one controller with one action. The action has both .rhtml and .rjs views. I put this in the action: respond_to do |format| format.html format.js end When I send an AJAX request from the html view to that action the response is the rhtml template, not the rjs template. When I change it to the following it works: respond_to do |format| format.html format.js { render :template => "index.rjs" } end That works fine. It was working fine a few months ago, now all of a sudden it doesn''t. Do I need to define a response for rjs? I have no plugins, nothing, this is a completely clean and fresh rails app. Thanks for your help. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ben Johnson wrote:> When I send an AJAX request from the html view to that action the > response is the rhtml template, not the rjs template. When I change it > to the following it works: > > respond_to do |format| > format.html > format.js { render :template => "index.rjs" } > endFirst of all, your post help me solve a similar problem, so thank you! Then I can hopefully help you, because I know exactly when this problem suddenly occured for me: I use the above in a installation of the Beast forum. And it has worked fine while running Rails v. 1.2.6 When I upgraded to Rails 2.0.2 it simply stopped working - until I applied your solution minutes ago. So: What version of Rails are you running? - Carsten -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-19 16:44 UTC
Re: respond_to not working with RJS in rails?
Seeing as you''re on Rails 2.0+, try naming your files: index.html.erb index.js.rjs On Jan 18, 4:51 pm, Ben Johnson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I just created a new rails app to test this out, using edge rails. I > have one controller with one action. The action has both .rhtml and .rjs > views. I put this in the action: > > respond_to do |format| > format.html > format.js > end > > When I send an AJAX request from the html view to that action the > response is the rhtml template, not the rjs template. When I change it > to the following it works: > > respond_to do |format| > format.html > format.js { render :template => "index.rjs" } > end > > That works fine. > > It was working fine a few months ago, now all of a sudden it doesn''t. Do > I need to define a response for rjs? > > I have no plugins, nothing, this is a completely clean and fresh rails > app. > > Thanks for your help. > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Seeing as you''re on Rails 2.0+, try naming your files: > > index.html.erb > index.js.rjs > > On Jan 18, 4:51�pm, Ben Johnson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>That fixed the problem. Did they really change the naming format for views? So this is the "right" way to name your views now? Is there any article about this or something. Thats kind of a big change to not announce, but maybe I missed the announcement. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-19 18:39 UTC
Re: respond_to not working with RJS in rails?
Yes, I believe this change was widely advertised. It''s now "action.format.language" Ex.: index.html.erb # use Erb index.html.haml # use Haml index.html.mab # use Markaby index.iphone.erb # serve iPhone content if MimeType is aliased and user agent is detected On Jan 19, 11:12 am, Ben Johnson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> stephen.ce...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > Seeing as you''re on Rails 2.0+, try naming your files: > > > index.html.erb > > index.js.rjs > > > On Jan 18, 4:51�pm, Ben Johnson <rails-mailing-l...-ARtvInVfO7m5VldFQK4jKA@public.gmane.orgt> > > That fixed the problem. > > Did they really change the naming format for views? So this is the > "right" way to name your views now? Is there any article about this or > something. Thats kind of a big change to not announce, but maybe I > missed the announcement. > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Yes, I believe this change was widely advertised. It''s now > "action.format.language" > > Ex.: > > index.html.erb # use Erb > index.html.haml # use Haml > index.html.mab # use Markaby > index.iphone.erb # serve iPhone content if MimeType is aliased and > user agent is detected > > On Jan 19, 11:12 am, Ben Johnson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Is rhtml gone, I was under the impression that was erb. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Yes, I believe this change was widely advertised. It''s now > "action.format.language" > > Ex.: > > index.html.erb # use Erb > index.html.haml # use Haml > index.html.mab # use Markaby > index.iphone.erb # serve iPhone content if MimeType is aliased and > user agent is detectedAlthough it was also widely advertised, that the old naming convention still would be in use.... It seems that it isn''t. - Carsten -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-19 21:51 UTC
Re: respond_to not working with RJS in rails?
It works, but it isn''t as "smart". I.e., when you omit the format from the filename, respond_to doesn''t work without further specification. On Jan 19, 2:58 pm, Carsten Gehling <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> stephen.ce...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > Yes, I believe this change was widely advertised. It''s now > > "action.format.language" > > > Ex.: > > > index.html.erb # use Erb > > index.html.haml # use Haml > > index.html.mab # use Markaby > > index.iphone.erb # serve iPhone content if MimeType is aliased and > > user agent is detected > > Although it was also widely advertised, that the old naming convention > still would be in use.... It seems that it isn''t. > > - Carsten > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> It works, but it isn''t as "smart". I.e., when you omit the format from > the filename, respond_to doesn''t work without further specification. > > On Jan 19, 2:58�pm, Carsten Gehling <rails-mailing-l...@andreas-s.net>So do you use rhtml or erb? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-19 22:18 UTC
Re: respond_to not working with RJS in rails?
You should move to the new naming standard. Files suffixed .rhtml are backwards-compatible, but not preferable. Rhtml IS erb, the naming convention just allows you to easily do more... styles.css.erb On Jan 19, 4:03 pm, Ben Johnson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> stephen.ce...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > > It works, but it isn''t as "smart". I.e., when you omit the format from > > the filename, respond_to doesn''t work without further specification. > > > On Jan 19, 2:58�pm, Carsten Gehling <rails-mailing-l...@andreas-s.net> > > So do you use rhtml or erb? > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---