Module: SimplyCouch::Model::Database

Included in:
ClassMethods
Defined in:
lib/simply_couch/model/database.rb

Instance Method Summary collapse

Instance Method Details

#couchrest_database_urlObject

Override this to provide a custom database URL. In Rails, reads config/couchdb.yml automatically.



16
17
18
# File 'lib/simply_couch/model/database.rb', line 16

def couchrest_database_url
  @_couchrest_database_url || detect_couchdb_url || ENV['COUCHDB_URL'] || 'http://127.0.0.1:5984'
end

#couchrest_database_url=(url) ⇒ Object



20
21
22
# File 'lib/simply_couch/model/database.rb', line 20

def couchrest_database_url=(url)
  @_couchrest_database_url = url
end

#databaseObject



4
5
6
7
8
9
10
11
12
# File 'lib/simply_couch/model/database.rb', line 4

def database
  @_simply_couch_database ||= begin
    if @_couchrest_database_url
      DatabaseInstance.new(full_database_url)
    else
      SimplyCouch.database
    end
  end
end