I'm working with a legacy database and I've been trying to figure out
how to override storage_name.. Right now I have a class called Staff
that sets it's storage_name to "staffs" when I need to be "staff".
While digging around the IRC logs and this list, I've come across the
following method, that actually does work:
<pre>
class Staff
include DataMapper::Resource
# override the table name
class << self
def storage_name(repository_name = default_repository_name)
'staff'
end
end
property :id, Serial
# etc....
end
</pre>
What I am curious about is if I missed some easier way of doing this?
I didn't see anything in the API or the Wiki or the docs.. The above
approach seems pretty clunky..
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---