sean.alien8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010-Sep-29 17:17 UTC
how to get rails 3 to respons with js?
Hi All, Does anyone have experience with rails 3 refusing to return js (or some other format) in controller actions that are designed to return both html and some other format? I have the following code: respond_to :html, :js def index @artist = Artist.find_by_url(params[:artist_id]) @tour_dates = TourDate.for_artist(@artist) respond_with(@tour_dates) end When I do a js request for this action it renders and returns my index.html.erb as the response body, even though i have a nice index.js.erb file. Here''s the log: Started GET "/admin/artists/aube/tour_dates" for 127.0.0.1 at 2010-09-29 13:08:07 -0400 Processing by Admin::TourDatesController#index as JS Parameters: {"artist_id"=>"aube"} ... Rendered collection (0.0ms) Rendered admin/tour_dates/index.html.erb (2.5ms) Completed 200 OK in 266ms (Views: 35.8ms | ActiveRecord: 2.5ms) Any idea why rails it not handling the non-html formats properly? Thanks, Sean -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
sean.alien8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> When I do a js request for this action it renders and returns my > index.html.erb as the response body, even though i have a nice > index.js.erb file. Here''s the log:What about index.rjs instead of index.js.erb? That should work. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.