I can respect that...i'll write my own monkey patch so - you mentioned previously you had already created a default_options method that you were using privately - could I be so cheeky as to ask for permission to use it as a basis for my own effort?
Also, what are your thoughts on message evaluation? I was looking at this last night and in the current source it looks like the generic_validator is where it would need to go to be consistent and dry across all validations (def add_error_message i believe). Also, I'm not sure passing the record into the message proc is the right way to go?? This limits you to the public properties on the record when in alot of cases its probably advantegous to have some private or protected methods to generate message fragments. On Jan 15, 11:48 am, Michael Klishin <[email protected]> wrote: > I lean towards what Adam suggested: if there is a way already to do it > effortlessly, maybe even > it is an eye soar to some, no need to add more code to -core. > More code means more bugs, slower execution > and more spec examples to add to some (at first glance unrelated) > places. Yes, I am totally > merb-brain-damaged and all that. > > This particular feature can be a plugin. It would require some simple > refactoring in -core, > but this is what -core is all about: being open for extension. > > What we end up with for > now:http://datamapper.lighthouseapp.com/projects/20609-datamapper/tickets... > > On 14.01.2009, at 18:18, heda wrote: > > > > > too messy when you have sets of options > > > opts = {:auto_validation => false} > > opts_string = opts.merge({:size => 50}) > > opts_decimal = opts.merge({:precision => 10, :scale => 4}) > > > property :firstname, String, opts_string > > property :lastname, String, opts_string > > > property :minimum, BigDecimal, opts_decimal.merge({:nullable => > > false}) > > property :maximum, BigDecimal, opts_decimal > > > ===== > > > much cleaner and easier to read with something like > > > with_default_options {:auto_validation => false} do > > > with_default_options {:size => 50} do > > property :firstname, String > > property :lastname, String > > end > > > with_default_options {:precision => 10, :scale => 4} do > > property :minimum, BigDecimal, :nullable => false > > property :lastname, BigDecimal > > end > > > end > > MK --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" 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/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
