Module: CouchPotato
- Defined in:
- lib/couch_potato.rb,
lib/couch_potato/railtie.rb,
lib/couch_potato/database.rb,
lib/couch_potato/validation.rb,
lib/couch_potato/persistence.rb,
lib/couch_potato/rspec/matchers.rb,
lib/couch_potato/view/view_query.rb,
lib/couch_potato/persistence/json.rb,
lib/couch_potato/view/custom_views.rb,
lib/couch_potato/view/raw_view_spec.rb,
lib/couch_potato/view/base_view_spec.rb,
lib/couch_potato/view/model_view_spec.rb,
lib/couch_potato/persistence/callbacks.rb,
lib/couch_potato/view/custom_view_spec.rb,
lib/couch_potato/persistence/properties.rb,
lib/couch_potato/persistence/attachments.rb,
lib/couch_potato/persistence/type_caster.rb,
lib/couch_potato/view/properties_view_spec.rb,
lib/couch_potato/persistence/simple_property.rb,
lib/couch_potato/validation/with_validatable.rb,
lib/couch_potato/persistence/dirty_attributes.rb,
lib/couch_potato/persistence/ghost_attributes.rb,
lib/couch_potato/persistence/magic_timestamps.rb,
lib/couch_potato/validation/with_active_model.rb,
lib/couch_potato/rspec/matchers/map_to_matcher.rb,
lib/couch_potato/rspec/matchers/reduce_to_matcher.rb,
lib/couch_potato/persistence/active_model_compliance.rb
Defined Under Namespace
Modules: Attachments, GhostAttributes, MagicTimestamps, Persistence, RSpec, Validation, View Classes: Database, Railtie
Constant Summary collapse
- Config =
Struct.new(:database_name, :validation_framework).new
Class Method Summary collapse
-
.couchrest_database ⇒ Object
Returns the underlying CouchRest database object if you want low level access to your CouchDB.
-
.database ⇒ Object
Returns a database instance which you can then use to create objects and query views.
- .rails_init ⇒ Object
Class Method Details
.couchrest_database ⇒ Object
Returns the underlying CouchRest database object if you want low level access to your CouchDB. You have to set the CouchPotato::Config.database_name before this works.
21 22 23 |
# File 'lib/couch_potato.rb', line 21 def self.couchrest_database @@__couchrest_database ||= CouchRest.database(full_url_to_database) end |
.database ⇒ Object
Returns a database instance which you can then use to create objects and query views. You have to set the CouchPotato::Config.database_name before this works.
16 17 18 |
# File 'lib/couch_potato.rb', line 16 def self.database @@__database ||= Database.new(self.couchrest_database) end |
.rails_init ⇒ Object
5 6 7 |
# File 'lib/couch_potato/railtie.rb', line 5 def self.rails_init CouchPotato::Config.database_name = YAML::load(File.read(Rails.root.join('config/couchdb.yml')))[Rails.env] end |