Tag: Rails/Tips
config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += Dir["#{config.root}/lib/**/"]
Hoge -> 'hoge.rb' を読み込む Hoge::Mogu -> 'hoge/mogu.rb' を読み込む HogeMogu -> 'hoge_mogu.rb' を読み込む
rake assets:precompile
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= stylesheet_link_tag "application", media: "all" %> <%= javascript_include_tag "application" %>
//= require jquery //= require jquery_ujs //= require turbolinks <- 削除 //= require_tree .
include ActionView::Helpers::TextHelper
<%= Rails.version %>
<%= RUBY_VERSION %>
module MySite class Application VERSION = "0.0.4" end end
module MySite class Application < Rails::Application VERSION = "1.1.0" end end
config.my_special_value = 'val'
Rails.application.config.my_special_value
db:seedを使ってデータを投入できる。
Book.create(title: "title1", author: 'author1', summary: 'summary1') Book.create(title: "title2", author: 'author2', summary: 'summary2')
bundle exec rake db:seed RAILS_ENV=development
bundle exec rake db:reset RAILS_ENV=development
bundle exec rake db:reset RAILS_ENV=development