开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜