Skip to content
This repository
Browse code

Even more polish of the default configration files and split off the …

…session store configuration into its own file
  • Loading branch information...
commit 6e66e7d6460b99bb0877a891aa3fbb789b563123 1 parent c5f461d
David Heinemeier Hansson authored November 30, 2008
13  railties/configs/initializers/session_store.rb
... ...
@@ -0,0 +1,13 @@
  1
+# Your secret key for verifying cookie session data integrity.
  2
+# If you change this key, all old sessions will become invalid!
  3
+# Make sure the secret is at least 30 characters and all random, 
  4
+# no regular words or you'll be exposed to dictionary attacks.
  5
+ActionController::Base.session = {
  6
+  :session_key => '_<%= app_name %>_session',
  7
+  :secret      => '<%= app_secret %>'
  8
+}
  9
+
  10
+# Use the database for sessions instead of the cookie-based default,
  11
+# which shouldn't be used to store highly confidential information
  12
+# (create the session table with "rake db:sessions:create")
  13
+# ActionController::Base.session_store = :active_record_store
37  railties/environments/environment.rb
@@ -12,7 +12,7 @@
12 12
   # -- all .rb files in that directory are automatically loaded.
13 13
 
14 14
   # Add additional load paths for your own custom dirs
15  
-  # config.load_paths += %W( #{RAILS_ROOT}/extras )
  15
+  # config.load_paths += %w( #{RAILS_ROOT}/extras )
16 16
 
17 17
   # Specify gems that this application depends on and have them installed with rake gems:install
18 18
   # config.gem "bj"
@@ -28,35 +28,14 @@
28 28
   # you must remove the Active Record framework.
29 29
   # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
30 30
 
31  
-  # Make Time.zone default to the specified zone, and make Active Record store time values
32  
-  # in the database in UTC, and return them converted to the specified local zone.
33  
-  # Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
  31
+  # Activate observers that should always be running
  32
+  # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
  33
+
  34
+  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  35
+  # Run "rake -D time" for a list of tasks for finding time zone names.
34 36
   config.time_zone = 'UTC'
35 37
 
36  
-  # The internationalization framework can be changed to have another default locale (default is :en) or more load paths.
37  
-  # All files from config/locales/*.rb,yml are added automatically.
  38
+  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
38 39
   # config.i18n.load_path << Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
39 40
   # config.i18n.default_locale = :de
40  
-
41  
-  # Your secret key for verifying cookie session data integrity.
42  
-  # If you change this key, all old sessions will become invalid!
43  
-  # Make sure the secret is at least 30 characters and all random, 
44  
-  # no regular words or you'll be exposed to dictionary attacks.
45  
-  config.action_controller.session = {
46  
-    :session_key => '_<%= app_name %>_session',
47  
-    :secret      => '<%= app_secret %>'
48  
-  }
49  
-
50  
-  # Use the database for sessions instead of the cookie-based default,
51  
-  # which shouldn't be used to store highly confidential information
52  
-  # (create the session table with "rake db:sessions:create")
53  
-  # config.action_controller.session_store = :active_record_store
54  
-
55  
-  # Use SQL instead of Active Record's schema dumper when creating the test database.
56  
-  # This is necessary if your schema can't be completely dumped by the schema dumper,
57  
-  # like if you have constraints or database-specific column types
58  
-  # config.active_record.schema_format = :sql
59  
-
60  
-  # Activate observers that should always be running
61  
-  # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
62  
-end
  41
+end
5  railties/environments/test.rb
@@ -20,3 +20,8 @@
20 20
 # The :test delivery method accumulates sent emails in the
21 21
 # ActionMailer::Base.deliveries array.
22 22
 config.action_mailer.delivery_method = :test
  23
+
  24
+# Use SQL instead of Active Record's schema dumper when creating the test database.
  25
+# This is necessary if your schema can't be completely dumped by the schema dumper,
  26
+# like if you have constraints or database-specific column types
  27
+# config.active_record.schema_format = :sql

2 notes on commit 6e66e7d

Henrik Nyh

So it wasn’t first changed in this commit, but: on line 32 of the new version, observers are assigned as “config.active_record.observers = :cacher, :garbage_collector, :forum_observer”. Is that missing square brackets?

Dennis Reimann

yes, they are missing.

Roman Le Négrate

%W was correct. %w won’t perform interpolation.

Roman Le Négrate

This line should rather read: config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]

David Heinemeier Hansson
Owner

Thanks for the code review, guys. Got it in on http://github.com/rails/rails/commit/bf024b6a11253b3d2599caf41f7ccf2d31e68cb3

Please sign in to comment.
Something went wrong with that request. Please try again.