My code looks like the following, but for some reason the rjs template (index.js.erb) is not being rendered. I''ve also tried naming the rjs file index.js.rjs with no luck. home_controller.rb: def index respond_to do |format| format.js format.html end end index.js.erb: page << "var data = ''Core Selectors,Attributes,Traversing,Manipulation''.split('','');" page << "$(''#example'').autocomplete(data);" How does rails decide when to render an rjs file in addition to an html file? -- 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 -~----------~----~----~----~------~----~------~--~---
On 29 Dec 2008, at 08:42, Adam Thorsen wrote:> > My code looks like the following, but for some reason the rjs template > (index.js.erb) is not being rendered. I''ve also tried naming the rjs > file index.js.rjs with no luck. >What does the thing making the request look like ?(index.js.erb will never work, since it will just try and pass that file through erb even though that file isn''t an erb template at all) Fred> home_controller.rb: > > def index > respond_to do |format| > format.js > format.html > end > end > > index.js.erb: > > page << "var data = ''Core > Selectors,Attributes,Traversing,Manipulation''.split('','');" > page << "$(''#example'').autocomplete(data);" > > How does rails decide when to render an rjs file in addition to an > html > file? > -- > 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 -~----------~----~----~----~------~----~------~--~---
You need to rename it to index.js.rjs. Check in firebug then if you get response. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---