Skip to content

Instantly share code, notes, and snippets.

@hrysd
Created April 12, 2014 15:51
Show Gist options
  • Select an option

  • Save hrysd/10542523 to your computer and use it in GitHub Desktop.

Select an option

Save hrysd/10542523 to your computer and use it in GitHub Desktop.
config の diff。 `rails new hoge`
diff --git a/config/database.yml b/config/database.yml
index 51a4dd4..1c1a37c 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -3,23 +3,23 @@
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
-development:
+#
+default: &default
adapter: sqlite3
- database: db/development.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:
- adapter: sqlite3
+ <<: *default
database: db/test.sqlite3
- pool: 5
- timeout: 5000
production:
- adapter: sqlite3
+ <<: *default
database: db/production.sqlite3
- pool: 5
- timeout: 5000
diff --git a/config/environment.rb b/config/environment.rb
index 72eb4c7..ee8d90d 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
-Hoge::Application.initialize!
+Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
index dbaca41..ddf0e90 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,4 +1,4 @@
-Hoge::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
@@ -19,11 +19,19 @@ Hoge::Application.configure do
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
- # Raise an error on page load if there are pending migrations
+ # Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
+
+ # Adds additional error checking when serving assets at runtime.
+ # Checks for improperly declared sprockets dependencies.
+ # Raises helpful error messages.
+ config.assets.raise_runtime_errors = true
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index efd2b47..47d3553 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,11 +1,11 @@
-Hoge::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
- # your application in memory, allowing both thread web servers
+ # your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
@@ -66,7 +66,7 @@ Hoge::Application.configure do
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found).
+ # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
@@ -77,4 +77,7 @@ Hoge::Application.configure do
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 29c45bb..053f5b6 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,4 +1,4 @@
-Hoge::Application.configure do
+Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
@@ -14,7 +14,7 @@ Hoge::Application.configure do
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
- config.static_cache_control = "public, max-age=3600"
+ config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true
@@ -33,4 +33,7 @@ Hoge::Application.configure do
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
end
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
new file mode 100644
index 0000000..7a06a89
--- /dev/null
+++ b/config/initializers/cookies_serializer.rb
@@ -0,0 +1,3 @@
+# Be sure to restart your server when you modify this file.
+
+Rails.application.config.action_dispatch.cookies_serializer = :json
\ No newline at end of file
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index 72aca7e..dc18996 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -2,4 +2,3 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
deleted file mode 100644
index b327ff3..0000000
--- a/config/initializers/secret_token.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# Your secret key is used for verifying the integrity of signed cookies.
-# If you change this key, all old signed cookies will become invalid!
-
-# Make sure the secret is at least 30 characters and all random,
-# no regular words or you'll be exposed to dictionary attacks.
-# You can use `rake secret` to generate a secure secret key.
-
-# Make sure your secret_key_base is kept private
-# if you're sharing your code publicly.
-Hoge::Application.config.secret_key_base = 'f6ecaeda02304e3f903e11657f9b24a2da614a625630ea72d4adde836aa52f0920bf825e5ad119b21d58c82864a6488e538f3f28bc35582004e1b85fffe15359'
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 2b26fd7..6e3df17 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
-Hoge::Application.config.session_store :cookie_store, key: '_hoge_session'
+Rails.application.config.session_store :cookie_store, key: '_hoge_session'
diff --git a/config/routes.rb b/config/routes.rb
index 67153f8..3f66539 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,4 @@
-Hoge::Application.routes.draw do
+Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
diff --git a/config/secrets.yml b/config/secrets.yml
new file mode 100644
index 0000000..c66d6b6
--- /dev/null
+++ b/config/secrets.yml
@@ -0,0 +1,22 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key is used for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+# You can use `rake secret` to generate a secure secret key.
+
+# Make sure the secrets in this file are kept private
+# if you're sharing your code publicly.
+
+development:
+ secret_key_base: 667db2b99a0ebab91c315655c110e208cec75267db64c850a5b5371566a5098c067554d2d2e096d3bc168b2d087964cc495989889836ca3d2c74d347d340030f
+
+test:
+ secret_key_base: f8032550820bcdcdcf1eb9c715ce97dee5ee118b5b701066332dfeb89748f59b823fb99cdeccdbd874d5c755e04165bfaec3d9a492e121b023d3479aa187ff82
+
+# Do not keep production secrets in the repository,
+# instead read values from the environment.
+production:
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment