Options
not available in models, even if you pass them as a parameter, then this will be considered bad practice and can also be dangerous.
What you can do is create a virtual attribute and use it in your model.
class User < ActiveRecord::Base attr_accessible :name, :sign_up_date has_many :enrollments after_create :create_enrollment_log private def create_enrollment_log enrollments.create!(status: 'signed up', started: sign_up_date) end end
Where sign_up_date is your virtual attribute
Muhamamd Awais
source share