> you > absolutely need to be able to pass in DEFAULT at minimum - which > requires non-quoting and non-typecasting of the value.
How about not putting that column (and the meaningless NULL value) into the INSERT statement if it is a new record on a column with a default value function (as opposed to a default value constant, which is the norm)? Would that work? If I understand what you're aiming for correctly, I think you may meet resistance to getting ar-defaults into Rails core, because non-constant default values is a thing that not many people use with an ORM layer, and does not fit well into the ORM lifecycle; for example, it is expected that when you initialize a new record, the attributes on that record should all be fit to display. If the attribute value isn't determined until the record gets inserted into the database, that's a no-go. (Similarly you'd need to reload the attributes after insert to find their values after save.) As a general rule, I think "we" like doing our model work in our app, rather than the DB - it's more of a choice we've made than a "this is the only right way to do it in the world" kind of statement, there's plenty of room to do it other ways. IMHO, there'll always be people who need to step outside the box sometimes, but unfortunately core Rails libraries can't necessarily cater to all of them - we'd end up like Microsoft Word where everyone only uses 10%... but a different 10% each :). But if there's something simple that we can do to make life easier for them, maybe that's a better bet, whether it's cleaning up internals slightly to make it easier to hook in plugins, or maybe if it's a small patch making changes like detecting "special" columns and leaving them out of inserts (if that works, as above). Personally, I think the http://drawohara.com/post/78208216/rails-activerecord-defaults-for-rails-2-2-2 you posted looks pretty clean already, so I think that should just get released as a plugin. We've all got our own list of "10% of Microsoft Word" features we need from our own plugins, me included :). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
