Apparently, in development mode, there are issues when it comes to reloading plugins. Because the model "Vote" in my case, or "Comment" in the blog post's case, is defined inside the plugin, Rails doesn't see that it should load it again. Anyway, better to read that post for an explanation.
What I did to fix it was add this code at the end of the environment.rb file:
# Array of plugins with Application model dependencies.See the code.
reloadable_plugins = ["acts_as_commentable"]
# Force these plugins to reload, avoiding stale object references.
reloadable_plugins.each do |plugin_name|
reloadable_path = RAILS_ROOT + "/vendor/plugins/#{plugin_name}/lib"
Dependencies.load_once_paths.delete(reloadable_path)
end
1 comment:
Excellent - just what I needed for my own rails development today. This is a lot better than killing brick and restarting it over and over!
Thx.
Post a Comment