Gavin wrote: > So, would it be more appropriate to write a method like > > def purchased? > if self.status > 3 > return true > else > return false > end > end > > and then call the purchased? method to perform the check? > > > > On 12 Feb, 14:39, Robert Walker <rails-mailing-l...@andreas-s.net>
Actually it could be as simple as adding some constants to represent your states. Example: STARTED = 1 PROCESSING = 2 COMPLETED = 3 BILLED = 4 PAID = 5 if self.state > COMPLETED You just want to avoid the use of a "magic number" by giving it clear meaning. -- 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---