Doh. It's that simple?! I had presumed that where properties are generated as a result of "belongs_to/has n" we could not declare them explicitly as well. It is a little confusing. Maybe the belongs_to could accept a :default value. Something for more knowledgeable DM folk to ponder...
Many thanks Chris, George On Oct 14, 7:50 pm, Chris <[email protected]> wrote: > property :world_region_id, Integer, :default => 1 > > 2009/10/14 George <[email protected]> > > > > > Hi all, > > > For normal properties we can specify a default like this: > > property :title, String, :default => "Mr" > > > How do we do it for properties added by "belongs_to" and "has n"? > > > For example: > > Country model belongs_to :worldRegion > > WorldRegion has n, :countries > > I'd like world_region_id of a new Country to default to, say, "1" > > > Many thanks > > George > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
