I'm trying to add a new variable (method) to my database query in rails. I don't want to add a new field to the database, I want to take an existing column and play with it to create a new method. However, it's not throwing an error or anything, it's just not available. Any ideas?
class Task < ActiveRecord::Base
attr_accessible :old_field, :new_field
def after_initialize
self.new_field = :old_field * 2
end
end
Partially, I'm not sure if this logic goes in the model or the controller.