Hi everyone, I am stuck in an (apparently) simple problem.
In my event_controller I have the i_like_it action:
def i_like_it
@event = Event.find(params[:id])
... # logic
respond_to do |format|
format.js
end
end
In my case "i_like_it" is called with :method => PUT (it is an Ajax
call, "i_like_it.js.erb" will be returned as a script and it wil be
executed on the browser.)
I would like render a Javascript file with a different name (not
i_like_it.js.erb) , but I haven''t found any option in the Rails API
docs.
respond_to do |format|
format.js { render ??? }
end
Rails can render vanilla JavaScript with :js option, but I don''t want
use Javascript in the controller.
Do you have any suggestion ?
Thank you,
Alessandro DS
--
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.
Ale Ds wrote:> Hi everyone, I am stuck in an (apparently) simple problem. > In my event_controller I have the i_like_it action: > > def i_like_it > @event = Event.find(params[:id]) > > ... # logic > > respond_to do |format| > format.js > end > end > > In my case "i_like_it" is called with :method => PUT (it is an Ajax > call, "i_like_it.js.erb" will be returned as a script and it wil be > executed on the browser.) > > I would like render a Javascript file with a different name (not > i_like_it.js.erb) , but I haven''t found any option in the Rails API > docs. > > respond_to do |format| > format.js { render ??? } > endHere you go- respond_to do |format| format.js { render :action => ''different_name.js.erb''} end -- 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.