Reputation: 519
I have a User
Model and it has a method like checkAge
. Now I don't want this in the User
model. I want User
model to be clean. So where should I put the checkAge
method.
Upvotes: 0
Views: 113
Reputation: 2017
You could put checkAge
method in the application_helper.rb
file in the helpers folder
Upvotes: 0
Reputation: 2034
Its totally depends on you, you can make separate classes and put code based on your requirement in those classes, Like @john mentioned you can add those classed in services, or you can add these classes in any sub folder in models
one other solution to just check age then you should use a decorator if you need to show this on views
Upvotes: 0
Reputation: 31
In our past project, we store business logical codes into the app/services folder(layer). Every business module define a pure ruby class. And controller call this service object to handle this stuff.
Upvotes: 2