翻譯並摘自http://guides.rubyonrails.org/layouts_and_rendering.htmljavascript
Asset tag helpers provide methods for generating HTML that link views to feeds, JavaScript, stylesheets, images, videos and audios. html
早期的Rails,js目錄在public/javascripts目錄,使用了Asset Pipeline以後,js目錄在/assets/javascripts。java
<%= javascript_include_tag "main" %>
rails輸出爲ios
<script src='/public/javascripts/main.js'></script>
注:若是是Asset Pipeline,rails輸出則爲<script src='/assets/javascripts/main.js'></script>ruby
<%= javascript_include_tag "main", "columns" %>
輸出爲ide
<script src='/public/javascripts/main.js'></script> <script src='/public/javascripts/columns.js'></script>
stylesheet_link_tag與javascript_include_tag 相似,再也不贅述ui