thedarkone / rails-dev-boost

Speed up slow Rails development mode
MIT License
467 stars 46 forks source link

Mongoid not reloading models #27

Closed Arjeno closed 12 years ago

Arjeno commented 13 years ago

First of all I've got a huge performance boost. This is a great gem! However it looks like it's not properly working with Mongoid. All/any changes in a model is not being picked up by the gem and I have to restart the server each time. Any ideas?

Arjeno commented 13 years ago

Looks like some models are working properly. I'll investigate further when I have time for it.

thedarkone commented 13 years ago

Hey,

any chance you could create a sample 1 model, 1 controller app to demonstrate the issue?

l4u commented 13 years ago

I am experiencing this too. Using rails3.1

thedarkone commented 13 years ago

alright, had a look around the Mongoid's code base and created an experimental mongoid branch here: rails-dev-boost/mongoid

Could you please update your Gemfiles with:

gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git', :branch => 'mongoid'

and report back the results?

Arjeno commented 13 years ago

Will try this soon and get back to you. Thanks :)

dcu commented 13 years ago

I am going to test that branch as well

dcu commented 13 years ago

the patch does not work here

thedarkone commented 13 years ago

@dcu: what version of mongoid are you using?

thedarkone commented 13 years ago

@dcu: can you also please test this another rails-dev-boost/mongoid-brute-force branch?

gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git', :branch => 'mongoid-brute-force'
dcu commented 13 years ago

mongoid 2.3.2, I am testing the new branch now

dcu commented 13 years ago

it has been working well so far

Arjeno commented 13 years ago

I'm using the brute-force branch now as well. Will let you know how it works.

Arjeno commented 13 years ago

Not working for me. Still caching every now and then forcing me to restart the server.

thedarkone commented 13 years ago

@Arjeno are you sure you are not storing references to mongo model objects/classes at the class level?

class A
  @mongo_model = MongoModel # can't be doing this!

  def self.first_record
    @first_record ||= MongoModel.first # or this!
  end
end
thedarkone commented 12 years ago

@nickhoffman is asking if this happens for all mongoid models or only for those inheriting from other models?

Also, do you have model preloading enabled?

@Arjeno: are you sure the breakage is not due to the "reloadable constant inter-references"? See the Known limitations section of the README for more info.

thedarkone commented 12 years ago

I have reports that my changes have fixed the outstanding Mongoid issues: here.

I'm closing this.

@Arjeno feel free to get back to me if things are still broken for you.