Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spork Should Auto-reload Models by default #94

Closed
apolzon opened this issue Mar 21, 2011 · 3 comments
Closed

Spork Should Auto-reload Models by default #94

apolzon opened this issue Mar 21, 2011 · 3 comments

Comments

@apolzon
Copy link

apolzon commented Mar 21, 2011

I'm unsure if this is a bug or a feature request, but currently (using Rails3.0.5/Spork0.9.0.rc4), if you want your models reloaded without putting your entire environment load into the Spork.each_run block, you must either use a Sporkfile or manually reload the files (i.e.:
Dir[Rails.root.join("app/models/*/.rb")].each { |f| load f }

It feels like the default should be for models to be reloaded, but if thats counter to the philosophy, feel free to close this issue.

@timcharper
Copy link
Contributor

Maybe you can come up with a better implementation, I am open to ideas.

Currently, spork does auto reload models by defualt by preventing them from being preloaded. (And other dev code like controllers). Some plugins cause the model code to be preloaded so some work is required to block that from happening. Spork.trap_method is the weapon of choice usually. There is a wiki article. Can you read it and lemme know what you think?

If you look at the cucumber features , it is the default behavior to reload models and others.

Spork might be too difficult to understand as this is a common gotcha.

@apolzon
Copy link
Author

apolzon commented Mar 21, 2011

No, that all makes sense, missed the trap command, thanks for pointing that out.

@apolzon apolzon closed this as completed Mar 21, 2011
@timcharper
Copy link
Contributor

k, great news. If you think of anything that will help newcomers let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants