Answer the question
In order to leave comments, you need to log in
When to move a method into a helper, and when into a module?
Do I understand correctly that the general methods for models are taken out in separate modules, for example,
models/user.rb
class User < ActiveRecord::Base
include Confirmable
...
end
module Confirmable
def some_method
...
end
end
Answer the question
In order to leave comments, you need to log in
For models and controllers, there are so-called concerns (Concerns), I think this is exactly what you need: artemeff.com/2013/04/21/concerns-v-rails-4.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question