README.rdoc in milia-0.2.0 vs README.rdoc in milia-0.3.2
- old
+ new
@@ -38,17 +38,24 @@
gem 'milia'
== Getting started
+=== Rails setup
+Milia expects a user session, so please set one up
+
+ $ rails g session_migration
+ invoke active_record
+ create db/migrate/20111012060818_add_sessions_table.rb
+
=== Devise setup
* See https://github.com/plataformatec/devise for how to set up devise.
* The current version of milia requires that devise use a *User* model.
=== Milia setup
*ALL* models require a tenanting field, whether they are to be universal or to
-be tenanted.
+be tenanted. So make sure the following is added to each migration
<i>db/migrate</i>
t.references :tenant
@@ -174,9 +181,19 @@
else
tenant.save # create the tenant
end
return tenant
end
+
+=== Alternate use case: user belongs to multiple tenants
+Your application might allow a user to belong to multiple tenants. You will need
+to provide some type of mechanism to allow the user to choose which account
+(thus tenant) they wish to access. Once chosen, in your controller, you will need
+to put:
+
+<i>app/controllers/any_controller.rb</i>
+
+ set_current_tenant( new_tenant_id )
== Cautions
* Milia designates a default_scope for all models (both universal and tenanted). From Rails 3.2 onwards, the last designated default scope overrides any prior scopes.
* Milia uses Thread.current[:tenant_id] to hold the current tenant for the existing Action request in the application.