How to prevent Rails 2.3.8 from checking all dependencies while loading

I have a rails 2.3.8 app which can be started without database. so in the environment.rb file i exclude ActiveRecord and in the application controller i render different pages when ActiveRecord is not defined. But when i try to upgrade mongral to passenger, passenger throws an Error

uninitialized constant ActiveRecord

The control is not going to the application controller at all. How can i make passenger not raise this exception.?

Attached the stacktrace

http://pastebin.com/1kXDwiRT

in abuses.rb i have

class Abuse < ActiveRecord::Base acts_as_paranoid

belongs_to :user belongs_to :review validates_presence_of :type, :message => _('cannot be blank') validates_presence_of :user, :on => :create, :if => Proc.new { |r| r.visitor_id == nil} validates_presence_of :visitor_id, :on => :create, :if => Proc.new { |r| r.user_id == nil} validates_length_of :comment, :maximum => 2000, :message => _('is too long 2000')

end

I cannot remove this model classes because they will be used when i start the website with ActiveRecord. I want to start the website without ActiveRecord in some emergency situation where the db is down. and i ll show the pages which doesnt database.

After further more researching i found that in intializer.rb file i have this function

def load_application_classes return if $rails_rake_task if configuration.cache_classes configuration.eager_load_paths.each do |load_path| matcher = /\A#{Regexp.escape(load_path)}(.*).rb\Z/ Dir.glob("#{load_path}/*/.rb").sort.each do |file| require_dependency file.sub(matcher, '\1') end end end end

commenting out the require_dependency line, makes the rails not to check Dependency of each and every file. Is there any way to disable this from the environment.rb config file? setting config.cache to false is working. but i want to cache the classes. but only not check the dependency.

Answers


Need Your Help

Jsoup get all links from a page

hyperlink jsoup

I'm implementing a web robot that has to get all the links from a page and select the needed ones. I got it all working except I encountered a probem where a link is inside a "table" or a "span" tag.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.