BTW - this shows why it's nice to have a separation between domain objects and database schema. With a proper data mapper pattern implementation you will have the ability to name your attributes however you want and map them to whatever you want.
-- Piotr Solnica - Senior Software Developer http://solnic.eu | http://github.com/solnic | http://twitter.com/_solnic_ On Saturday, December 3, 2011 at 1:20 PM, muthu wrote: > Awesome, that worked. > > Thanks, > > On Dec 3, 12:00 am, Chris Corbyn <[email protected] (http://w3style.co.uk)> > wrote: > > I think these sorts of things are a limitation of ORMs as a concept (albeit > > a minor one), along with words like 'transaction' and 'index'. I try to > > avoiding using reserved words like `key` in my schema, but if you have to > > work with it, rename it to something else on the DataMapper side. > > > > property :whatever, Integer, :field => 'key' > > > > Cheers, > > > > Chris > > > > On 03/12/2011, at 3:21 PM, muthu wrote: > > > > > > > > > > > > > > > > > Hi, > > > > > I have a database table called "xyz" with a column "key". But when I > > > try to run datamapper to save data, it throws the following: > > > > > > > > > > /Library/Ruby/Gems/1.8/gems/dm-core-1.2.0/lib/dm-core/property.rb: > > > 739:in `initialize': +name+ was "key", which cannot be used as a p > > > roperty name since it collides with an existing method or a query > > > option (ArgumentError) > > > from /Library/Ruby/Gems/1.8/gems/dm-core-1.2.0/lib/dm-core/ > > > property/string.rb:32:in `initialize' > > > from /Library/Ruby/Gems/1.8/gems/dm-core-1.2.0/lib/dm-core/ > > > model/property.rb:55:in `new' > > > from /Library/Ruby/Gems/1.8/gems/dm-core-1.2.0/lib/dm-core/ > > > model/property.rb:55:in `property' > > > from /Library/Ruby/Gems/1.8/gems/dm-validations-1.2.0/lib/dm- > > > validations/auto_validate.rb:11:in `property' > > > from app.rb:26 > > > > > > > > > > I have a table with column name itself as "key" > > > > > How can I fix this? > > > > > Thanks in advance > > > > > Muthu > > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "DataMapper" group. > > > To post to this group, send email to [email protected] > > > (mailto:[email protected]). > > > To unsubscribe from this group, send email to > > > [email protected] > > > (mailto:[email protected]). > > > For more options, visit this group > > > athttp://groups.google.com/group/datamapper?hl=en. > > > > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "DataMapper" group. > To post to this group, send email to [email protected] > (mailto:[email protected]). > To unsubscribe from this group, send email to > [email protected] > (mailto:[email protected]). > For more options, visit this group at > http://groups.google.com/group/datamapper?hl=en. > > -- 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.
