I'm creating a gem on Rails 5.
Let's say I have SomeModel
with a hello
method, which I use within myengine
:
# app/models/myengine/someModel.rb
module Myengine
class SomeModel < ApplicationRecord
def self.hello
puts 'hello world'
end
end
end
I would like to remove hello
method from default application and store it into a gem so I can plug it in only if I need to.
I don't know neither what to write to extend the model nor where to place that file.
I tried to fo through the Rails guidelines, but they are way too complicated! I got lost after several tries. I don't need Single Table Inheritance, I need to extend that specific model.
Tried already this answer which seems not quite right, and this one which doesn't unfortunately say much.
Any idea?