Why isn't this method rendering my .js.erb file?
I have this method in my videos controller:
def notification_go
current_user.render_read
respond_to do |format|
format.html
format.js { render 'notification_go.js.erb' }
end
end
It is not rendering my notification_go.js.erb
file in my videos
view directory. Why is this? How do I render it?
(My notification_go
method is called via an AJAX request. Not sure if that makes any difference.)
you dont need to specify render 'notification_go.js.erb' by default its already been mapped, the filename of notification_go.js.erb template with controller action notication_go
def notification_go
current_user.render_read
respond_to do |format|
format.html
format.js
end
end
Try passing
:format => :js
to path in your AJAX request.
精彩评论