popolo-project / popolo-engine

A reference implementation of Popolo as a Rails engine
MIT License
11 stars 7 forks source link

Add ability to configure mongoid #16

Closed walter closed 10 years ago

walter commented 10 years ago

Allows for setting a different session and database for the models.

jpmckinney commented 10 years ago

Why not just add store_in Popolo.storage_options to each model, and make storage_options be the class variable? The default value of storage_options can be {}.

walter commented 10 years ago

Originally I was also going to allow for configuration of collection, i.e. distinct per model configuration, which is probably why I built it the way I did.

I found configuring collection problematic, so I fell back to just database and session.

The simplified way certainly gets rid of a decent amount of boilerplate and makes the intention clearer. Will get back to you with a new commit.

walter commented 10 years ago

@jpmckinney that do the trick?

jpmckinney commented 10 years ago

Instead of { session: :default, database: :default }, just use {}. That way, we won't override any global settings the user may have set.

walter commented 10 years ago

Think that does it.