Ruby on Rails を使ったWebサービスの作り方(3)configファイルの変更
もくじページ
http://d.hatena.ne.jp/seika_m/20150815
home01>config>application.rb を編集します
class Application < Rails::Application
end
の中に以下を追加します
config.generators do |g|
#rails generate の際に、以下ファイルを生成しない
g.stylesheets false
g.javascripts false
g.helper false
g.test_framework false
end
# for Ajax
config.action_view.embed_authenticity_token_in_remote_forms = true
以下のようになります。
require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Home01 class Application < Rails::Application config.generators do |g| #rails generate の際に、以下ファイルを生成しない g.stylesheets false g.javascripts false g.helper false g.test_framework false end # for Ajax config.action_view.embed_authenticity_token_in_remote_forms = true # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true end end
home01>config>database.yml を編集します
production:
<
default: &default adapter: sqlite3 pool: 5 timeout: 5000 development: <<: *default database: db/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: db/test.sqlite3 production: <<: *default #本番環境では PostgreSQLを使う adapter: postgresql encoding: unicode