| 1 |
# Be sure to restart your web server when you modify this file. |
|---|
| 2 |
|
|---|
| 3 |
# Uncomment below to force Rails into production mode when |
|---|
| 4 |
# you don't control web/app server and can't set it the proper way |
|---|
| 5 |
# ENV['RAILS_ENV'] ||= 'production' |
|---|
| 6 |
|
|---|
| 7 |
# Bootstrap the Rails environment, frameworks, and default configuration |
|---|
| 8 |
require File.join(File.dirname(__FILE__), 'boot') |
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
RAILS_GEM_VERSION = '1.1.6' unless defined? RAILS_GEM_VERSION |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
require "#{RAILS_ROOT}/lib/ar_base_ext" |
|---|
| 15 |
|
|---|
| 16 |
Rails::Initializer.run do |config| |
|---|
| 17 |
# Settings in config/environments/* take precedence those specified here |
|---|
| 18 |
|
|---|
| 19 |
# Skip frameworks you're not going to use |
|---|
| 20 |
# config.frameworks -= [ :action_web_service ] |
|---|
| 21 |
|
|---|
| 22 |
# Add additional load paths for your own custom dirs |
|---|
| 23 |
config.load_paths += Dir["#{RAILS_ROOT}/app/models/[a-z]*"] |
|---|
| 24 |
config.load_paths += Dir["#{RAILS_ROOT}/app/controllers/[a-z]*"] |
|---|
| 25 |
config.load_paths += Dir["#{RAILS_ROOT}/lib/omdb/[a-z]*"] |
|---|
| 26 |
|
|---|
| 27 |
config.load_paths += %W( |
|---|
| 28 |
#{RAILS_ROOT}/vendor/RedCloth-3.0.4/lib |
|---|
| 29 |
#{RAILS_ROOT}/vendor/plugins/acts_as_versioned/lib |
|---|
| 30 |
#{RAILS_ROOT}/vendor/plugins/exception_notification/lib/ |
|---|
| 31 |
) |
|---|
| 32 |
|
|---|
| 33 |
# Force all environments to use the same logger level |
|---|
| 34 |
# (by default production uses :info, the others :debug) |
|---|
| 35 |
# config.log_level = :debug |
|---|
| 36 |
|
|---|
| 37 |
# Use the database for sessions instead of the file system |
|---|
| 38 |
# (create the session table with 'rake create_sessions_table') |
|---|
| 39 |
# config.action_controller.session_store = :active_record_store |
|---|
| 40 |
|
|---|
| 41 |
# Enable page/fragment caching by setting a file-based store |
|---|
| 42 |
# (remember to create the caching directory and make it readable to the application) |
|---|
| 43 |
# config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache" |
|---|
| 44 |
# |
|---|
| 45 |
|
|---|
| 46 |
# Activate observers that should always be running |
|---|
| 47 |
#better use observer :yourobserver in application controller |
|---|
| 48 |
#config.active_record.observers = :search_observer, :movie_observer, :category_observer |
|---|
| 49 |
|
|---|
| 50 |
# Make Active Record use UTC-base instead of local time |
|---|
| 51 |
config.active_record.default_timezone = :utc |
|---|
| 52 |
|
|---|
| 53 |
# Use Active Record's schema dumper instead of SQL when creating the test database |
|---|
| 54 |
# (enables use of different database adapters for development and test environments) |
|---|
| 55 |
# config.active_record.schema_format = :ruby |
|---|
| 56 |
end |
|---|
| 57 |
|
|---|
| 58 |
# Globalize Support |
|---|
| 59 |
$KCODE = 'u' |
|---|
| 60 |
require 'jcode' |
|---|
| 61 |
require 'ferret' |
|---|
| 62 |
require 'RMagick' |
|---|
| 63 |
|
|---|
| 64 |
include Globalize |
|---|
| 65 |
|
|---|
| 66 |
Locale.set_base_language 'en-US' |
|---|
| 67 |
|
|---|
| 68 |
# Load extensions to standard model classes |
|---|
| 69 |
[ "app/models/lib" ].each do |path| |
|---|
| 70 |
Dir["#{RAILS_ROOT}/#{path}/*.rb"].each do |file| |
|---|
| 71 |
load file |
|---|
| 72 |
end |
|---|
| 73 |
end |
|---|
| 74 |
|
|---|
| 75 |
# Add project-specific pluralization rules |
|---|
| 76 |
Inflector.inflections do |inflect| |
|---|
| 77 |
inflect.uncountable 'encyclopedia' |
|---|
| 78 |
inflect.irregular 'director_of_photography', 'directors_of_photography' |
|---|
| 79 |
end |
|---|
| 80 |
|
|---|
| 81 |
LOCALES = {'en' => 'en-US', |
|---|
| 82 |
'de' => 'de-DE'}.freeze |
|---|
| 83 |
|
|---|
| 84 |
ENV['LC_CTYPE'] = 'en_US.UTF-8' |
|---|
| 85 |
Ferret.locale = "en_US.UTF-8" |
|---|
| 86 |
|
|---|
| 87 |
require 'omdb' |
|---|
| 88 |
|
|---|
| 89 |
require 'cached_model' |
|---|
| 90 |
require 'indexer' |
|---|
| 91 |
include OMDB::Ferret |
|---|
| 92 |
|
|---|
| 93 |
memcache_options = { |
|---|
| 94 |
:c_threshold => 10_000, |
|---|
| 95 |
:compression => true, |
|---|
| 96 |
:debug => false, |
|---|
| 97 |
:namespace => "omdb_#{RAILS_ENV}", |
|---|
| 98 |
:readonly => (RAILS_ENV == 'test'), |
|---|
| 99 |
:urlencode => false |
|---|
| 100 |
} |
|---|
| 101 |
CACHE = MemCache.new memcache_options |
|---|
| 102 |
CACHE.servers = 'localhost:11211' |
|---|