1
- #---
2
- # Excerpted from "Agile Web Development with Rails"
3
- # We make no guarantees that this code is fit for any purpose.
4
- # Visit http://www.pragmaticprogrammer.com for more book information.
5
- #---
6
- RAILS_ROOT = File . dirname ( __FILE__ ) + "/../"
7
- RAILS_ENV = ENV [ 'RAILS_ENV' ] || 'development'
1
+ # Be sure to restart your webserver when you modify this file.
8
2
3
+ # Uncomment below to force Rails into production mode
4
+ # (Use only when you can't set environment variables through your web/app server)
5
+ # ENV['RAILS_ENV'] = 'production'
9
6
10
- # Mocks first.
11
- ADDITIONAL_LOAD_PATHS = [ " #{ RAILS_ROOT } /test/mocks/ #{ RAILS_ENV } " ]
7
+ # Bootstrap the Rails environment, frameworks, and default configuration
8
+ require File . join ( File . dirname ( __FILE__ ) , 'boot' )
12
9
13
- # Then model subdirectories.
14
- ADDITIONAL_LOAD_PATHS . concat ( Dir [ " #{ RAILS_ROOT } /app/models/[_a-z]*" ] )
15
- ADDITIONAL_LOAD_PATHS . concat ( Dir [ " #{ RAILS_ROOT } /components/[_a-z]*" ] )
10
+ Rails :: Initializer . run do | config |
11
+ # Skip frameworks you're not going to use
12
+ # config.frameworks -= [ :action_web_service, :action_mailer ]
16
13
17
- # Followed by the standard includes.
18
- ADDITIONAL_LOAD_PATHS . concat %w(
19
- app
20
- app/models
21
- app/controllers
22
- app/helpers
23
- app/apis
24
- config
25
- components
26
- lib
27
- vendor
28
- ) . map { |dir | "#{ RAILS_ROOT } /#{ dir } " }
14
+ # Add additional load paths for your own custom dirs
15
+ # config.load_paths += %W( #{RAILS_ROOT}/app/services )
29
16
30
- # Prepend to $LOAD_PATH
31
- ADDITIONAL_LOAD_PATHS . reverse . each { |dir | $:. unshift ( dir ) if File . directory? ( dir ) }
17
+ # Force all environments to use the same logger level
18
+ # (by default production uses :info, the others :debug)
19
+ # config.log_level = :debug
32
20
21
+ # Use the database for sessions instead of the file system
22
+ # (create the session table with 'rake create_sessions_table')
23
+ # config.action_controller.session_store = :active_record_store
33
24
34
- # Require Rails gems.
35
- require 'rubygems'
36
- require_gem 'activesupport'
37
- require_gem 'activerecord'
38
- require_gem 'actionpack'
39
- require_gem 'actionmailer'
40
- require_gem 'actionwebservice'
41
- require_gem 'rails'
25
+ # Enable page/fragment caching by setting a file-based store
26
+ # (remember to create the caching directory and make it readable to the application)
27
+ # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache"
42
28
29
+ # Activate observers that should always be running
30
+ # config.active_record.observers = :cacher, :garbage_collector
43
31
44
- # Environment-specific configuration.
45
- require_dependency "environments/#{ RAILS_ENV } "
46
- ActiveRecord ::Base . configurations = YAML ::load ( File . open ( "#{ RAILS_ROOT } /config/database.yml" ) )
47
- ActiveRecord ::Base . establish_connection
32
+ # Make Active Record use UTC-base instead of local time
33
+ # config.active_record.default_timezone = :utc
34
+
35
+ # Use Active Record's schema dumper instead of SQL when creating the test database
36
+ # (enables use of different database adapters for development and test environments)
37
+ # config.active_record.schema_format = :ruby
48
38
49
-
50
- # Configure defaults if the included environment did not.
51
- begin
52
- RAILS_DEFAULT_LOGGER = Logger . new ( "#{ RAILS_ROOT } /log/#{ RAILS_ENV } .log" )
53
- rescue StandardError
54
- RAILS_DEFAULT_LOGGER = Logger . new ( STDERR )
55
- RAILS_DEFAULT_LOGGER . level = Logger ::WARN
56
- RAILS_DEFAULT_LOGGER . warn (
57
- "Rails Error: Unable to access log file. Please ensure that log/#{ RAILS_ENV } .log exists and is chmod 0666. " +
58
- "The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
59
- )
39
+ # See Rails::Configuration for more options
60
40
end
61
41
62
- [ ActiveRecord , ActionController , ActionMailer ] . each { | mod | mod :: Base . logger ||= RAILS_DEFAULT_LOGGER }
63
- [ ActionController , ActionMailer ] . each { | mod | mod :: Base . template_root ||= " #{ RAILS_ROOT } /app/views/" }
64
- ActionController :: Routing :: Routes . reload
65
-
66
- Controllers = Dependencies :: LoadingModule . root (
67
- File . expand_path ( File . join ( RAILS_ROOT , 'app ', 'controllers' ) ) ,
68
- File . expand_path ( File . join ( RAILS_ROOT , 'components' ) )
69
- )
42
+ # Add new inflection rules using the following format
43
+ # (all these examples are active by default):
44
+ # Inflector.inflections do |inflect|
45
+ # inflect.plural /^(ox)$/i, '\1en'
46
+ # inflect.singular /^(ox)en/i, '\1'
47
+ # inflect.irregular 'person ', 'people'
48
+ # inflect.uncountable %w( fish sheep )
49
+ # end
70
50
71
- # Include your app's configuration here:
51
+ # Include your application configuration below
0 commit comments