On Wed, Aug 20, 2008 at 12:34 PM, Chris Cruft <[EMAIL PROTECTED]> wrote: > Honestly, having the persistence layer guess at what is "intended" to > be stored seems like a losing proposition. What's next? Guessing > that for a boolean field "Nein" means false and "Oui" means true and > that for an integer field that "Two" means 2 and "a lot" means 3?
Quick thought: I don't think calling #to_i is guessing. I see it as "I expect an integer, please provide me with whatever you can to satisfy that". I think most Ruby APIs are like that. So I always call #to_s or #to_i in methods that expect such types. Just like AR will call #to_i on #find when passed a string. It's ok, and it lets you do some more magic and makes your code look a lot better. Just my $0.2 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en -~----------~----~----~----~------~----~------~--~---
