Common method in model and helper

Viewed 24640

I have a common method that exists in my model because it is called by my model. Retrospectively, my view also requires this model method. In order to accomplish this, I have:

  1. moved the model method to the application_helper.rb file
  2. my model calls the application_helper method by adding include ApplicationHelper at the top of my ActiveRecord model

Functionality wise, it works. But is this good practice?

My Model looks like this:

class Client < ActiveRecord::Base
  include ApplicationHelper
end
4 Answers
Related