Flowdock

Notes posted by cheapRoc

RSS feed
April 14, 2009
0 thanks

Re: Force initial value

An alternative to @eric_programmer’s would be to extract it entirely from the controller logic…

class Person
  def sender
    self[:sender] || 'contact@host.com'
  end
end

There are a ton of ways to do it, but making this a business logic decision will let you get the same logic from any possible implementation angle. Scripts, web service, etc.