Well, you can still have those is_whatever? methods--just write them on the
model your own self:
class Child
def is_lost?
self.status == 'lost'
end
def is_found?
self.status == 'found'
end
def is_safe?
self.status = 'safe'
end
end
You could even write your own setters (def is_safe=(new_val)), tho that may be
taking it too far...
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of
Tony Tony
Sent: Tuesday, October 21, 2008 1:13 PM
To: [email protected]
Subject: [Rails] Re: Boolean database + Site Design/Architecture Question
Roy Pardee wrote:
> I would go with a single 'status' field.
Thanks Roy, I appreciate the reply. I guess I could just do a...
[code]
if @child.status == 'lost'
...
[/code]
I did like the elegance of boolean for things like:
[code]
if @child.is_lost?
...
[/code]
Any other suggestions or opinions?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---