I have some code in a plugin’s init.rb that used
+= … I spent a bit of time hacking engines to get it working, then I
Sven’s helpful message at
http://www.ruby-forum.com/topic/135196#602078(essentially “Contrary to
1.2.x the init.rb file is now evalutated inside of the Plugin object.”
just use code_paths += …)
Btw, I had to use self.code_paths +=, not code_paths by itself. Is that
“Hmm, we probably should put that into some kind of upgrade note. Or even
a rake task that goes through the init.rb files and removes those bits
Rails.Engines[:name]? But maybe that’s not worth the hassle?”
Yes definitely a message on how to migrate from 1.2.x to 2.x engines.
rake tast is probably not necessary imo, we are used to reading the
and making appropriate changes.
Anyways I thought I would include my changes in case someone finds them
useful. Definitely changing Rails.plugins[:plugin_name] to self is the
better way. But maybe someone will need to use this way for some
# Extends the superclass' load method to additionally mirror public
return if loaded?
# add plugin before calling initializer and anything else since
# to be the expected behavior
Engines.plugins << self
super initializer add_plugin_view_paths Assets.mirror_files_for(self)
def register_plugin_as_loaded(plugin) super plugin
Engines.plugins << plugin register_to_routing(plugin) end