Repositories

7 views
Skip to first unread message

Michishige Kaito

unread,
Apr 16, 2011, 12:37:40 AM4/16/11
to DataMapper Users Mailing List
Hey,

I came across the need to define a secondary repository, to access a set
of data handled by another application. Now, there are two things I
couldn't find in the API docs.

One, can I set a model to belong to a
certain repository, in the model declaration, so it doesn't get created
elsewhere upon running migrations, and so I don't have to wrap all calls
to it with DataMapper.repository()?

And two, since I'm accessing data handled by another app, it would
certainly be handy if the models I create for this could be read-only.

Any input is greatly apreciated.

Piotr Solnica

unread,
Apr 16, 2011, 4:18:43 AM4/16/11
to DataMapper
Hi,

You just need to define
self.default_repository_name; :other_repo_name;end at the beginning of
your model declaration.

For readonly models you can check out dm-is-read_only plugin.

Cheers

# solnic
Reply all
Reply to author
Forward
0 new messages