diff options
Diffstat (limited to 'lib/temporary_user.rb')
-rw-r--r-- | lib/temporary_user.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/temporary_user.rb b/lib/temporary_user.rb index e41add5..d0db1c4 100644 --- a/lib/temporary_user.rb +++ b/lib/temporary_user.rb @@ -13,6 +13,7 @@ module TemporaryUser extend ActiveSupport::Concern + USER_DB = 'users' TMP_USER_DB = 'tmp_users' TMP_LOGIN = 'tmp_user' # created and deleted frequently TEST_LOGIN = 'test_user' # created, rarely deleted @@ -38,12 +39,15 @@ module TemporaryUser end alias :find :get - # calls db_name(TMP_LOGIN), then creates a CouchRest::Database - # from the name + def database + @database ||= prepare_database USER_DB + end + def tmp_database @tmp_database ||= prepare_database TMP_USER_DB end + # create the tmp db if it doesn't exist. # requires admin access. def create_tmp_database! |