I said earlier that I understood the use case that made update_attribute be non-validating, but as I've thought about this more I'm not so sure anymore. My interpretation of what you are saying is that you have data in your database that doesn't validate, and you don't want your flag updating script to be stopped by this. So for whatever reason the data in your database and your validation code is out of sync. I'm not sure why this would happen, but I suppose that if it does happen it's typically a) something you want to be aware of, and b) something you want to correct as soon as possible, since any scheduled scripts that does use validation will be unable to save. Given all this I guess I might want my flag updating script to validate before it saves (so that I can be alerted of validation issues), and I might not, it depends on the situation.
I think there is general agreement that the naming of update_attribute is unfortunate since it doesn't in any way suggest why it isn't validating when the plural form of the method is. I haven't been following the discussions on the PoLS, but I think it's pretty obvious that it has always been a guiding principle in API design, even before the term was coined, and always will be. I think both Ruby and Rails make a great job following PoLS and that's one of the main reasons they are such a joy to use. An API that surprises you again and again will just be too frustrating and hard to use. It's common sense. I'm not the only one who has been surprised. Dave Thomas didn't know update_attribute is non-validating, which is why it's not in the book, and his spontaneous reaction when I told him about it was that it's probably a bug. I think that's what gave me the courage to bring up the issue here. I'm not on a one man crusade here to change the API. I accept the API won't change at this point, and no API will ever be perfect to everybody, and that's ok. I sincerely appreciate all the time you have put into clearifying things to me. This discussion has definitely given me some new insights. Thanks guys! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
