I am trying to create a rails website without using database.
So, i remove the active_record framework from environment.rb:
config.frameworks -= [ :active_record ]
Then, I encounter this problem if I run my server under
development mode:
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:278:in `load_missing_constant': uninitialized constant ActiveRecord (NameError)
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:467:in `const_missing'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:479:in `const_missing'
from /Users/macbookpro/documents/Projects/reddit/config/initializers/new_rails_defaults.rb:5
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:475:in `load_application_initializers'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:474:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:474:in `load_application_initializers'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:145:in `process'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:93:in `run'
from /Users/macbookpro/documents/Projects/reddit/public/../config/environment.rb:13
from /Users/macbookpro/documents/Projects/reddit/public/dispatch.fcgi:21:in `require'
from /Users/macbookpro/documents/Projects/reddit/public/dispatch.fcgi:21
Then, I found that the problem is actually caused by the new
added initializer file called new_rails_defaults.rb:
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
# Include Active Record class name as root for JSON serialized output.
# ActiveRecord::Base.include_root_in_json = true
# Store the full class name (including module namespace) in STI type column.
# ActiveRecord::Base.store_full_sti_class = true
# Use ISO 8601 format for JSON serialized times and dates.
ActiveSupport.use_standard_json_time_format = true
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
# if you're including raw json in an HTML page.
ActiveSupport.escape_html_entities_in_json = false
So, after I commented up the ActiveRecord command. Everything
seems alright! I am not sure that whether this will cause some
other problems or not.