views:

9

answers:

1

I am working with a database that is already in place and used by other applications.

The people who designed the database did not use pluralized table names, so DataMapper chooses the wrong table name when following associations.

For instance:

class Foo
  has n :components # => the table name here should be COMPONENT, but datamapper uses COMPONENTS
end 

How do I change this behavior?

A: 

Change the name on the model itself.

class Component
  # ...
  storage_names[:default] = 'component'
end
Matchu
Aha! Thank you. I'm new to DataMapper, so I didn't think to do that first. :)
Josiah Kiehl