I'm writing a Rails plugin to extend a Rails engine. Namely MyPlugin
has MyEngine
as a dependency.
On my Rails engine I have a MyEngine::Foo
model.
I'd like to add new methods to this model so I created a file in my plugin app/models/my_engine/foo.rb
which has the following code:
module MyEngine
class Foo
def sayhi
puts "hi"
end
end
end
If I enter the Rails console on the plugin dummy application I can find MyEngine::Foo
, but runnning MyEngine::Foo.new.sayhi
returns
NoMethodError: undefined method `sayhi'
Why MyPlugin
cannot see the updates to MyEngine::Foo
model? Where am I wrong?