Roy Pardee wrote:
> How about:
>
> def validate_dealer_id
> if number.blank? then
> errors.add_to_base("You must specify either a Dealer Number OR a Sub
> Dealer Number.") if subnumber.blank?
> else
> erros.add_to_base("A dealer can't have both a dealer number AND a
> sub dealer number") unless subnumber.blank?
> end
> end
>
> ?
>
> Extra bonus kibbitzing:
> - Would it make things any easier to store both those
> numbers in a single field, and keep track of whether
> a given dealer is a dealer or a sub in a separate 'dealer_type'
> field?
> - FWIW--the ruby convention is that methods whose names
> end in a ? return a boolean.
>
> Cheers,
>
> -Roy
I don't think that your above example is any cleaner then my original
solution. However, your bonus kibbitzing (lol) I think is a really good
thought. I am going to implement this logic on a later iteration.
Thanks for this.
--
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
-~----------~----~----~----~------~----~------~--~---