Gemfile
gem 'gon'
application.html.erb
<%= include_gon %>
pages_controller.rb
def index
gon.db = Page.all
...
回到console
bundle install
rails s
in AWS
RAILS_ENV=production bundle install
則可以在index頁面的Console中輸入gon.db 會得到Objects array
references
[1]Passing data to Javascript