Why is rails not rendering the .js.erb file?

前端 未结 4 510
耶瑟儿~
耶瑟儿~ 2021-02-06 05:56

I have a rails application where I am trying to have jQuery render WITH an HTML file. The point of this is that the jQuery is specific to the page so I don\'t want it loading f

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-06 06:20

    Sorry I'm late but you can call the JavaScript in "/messages/new.js.erb" by using:

    messages/new.html.erb

    link_to "Link", "", remote: true
    

    Any time you click that link it will fire "/messages/new.js.erb".

提交回复
热议问题