Displaying 1 result from an estimated 1 matches for "contact_by_email".
2006 Jun 22
3
attr_boolean, a good idea?
Hello all,
I''ve recently been working with a model with a lot of boolean
attributes and I decided that it''s worth trying to implement a
attr_boolean function to cut down on the work. Something like
class User < ActiveRecord::Base
attr_boolean :contact_by_email, :display_real_name, :administrator
end
which would replace the hand written
class User < ActiveRecord::Base
def contact_by_email?
self.contact_by_email == 1
end
def display_real_name?
self.contact_by_email == 1
end
def administrator?
self.contact_by_email =...