Hi,
I quickly ran into problems when trying to create an ActiveRecord instance that overrode initialize like this:
class Email < ActiveRecord::Base
belongs_to :lead
def initialize(email = nil)
self.email = email unless email.nil?
end
end
I found this post which cleared up why it is happening.
Is there anyway that I can avoid creation code like this:
e = Email.new
e.email = "[email protected]"
I would like to create and initialise my objects in one line of code preferably.
Is this possible?
Thanks
Paul