using an jquery in rails
reference
https://www.engineyard.com/blog/using-jquery-with-rails-how-to
preparing
- create new rails app
$ rails new APP_NAME
- add gem
gem 'jquery-rails'
- bundle
$ bundle install
- include jqury to application.js
//= require jquery3 //= require jquery_ujs //= require_tree .
test
- create tutorial resource
$ rails g resource tutorial title:string url:string $ rake db:migrate
- display table
# in app/controllers/tutorials_controller.rb def index @tutorials = Tutorial.all end
- display table
<!-- in app/views/tutorial/index.html.erb (create one) -->
<h1>Tutorials</h1>
<ul>
<% @tutorials.each do |tutorial| %>
<li><%= tutorial.title %></li>
<% end %>
</ul>