Sha256: fbde95cd964e29208acc6b58df481e6691f4faba0808a67b29e2b766558937eb

Contents?: true

Size: 396 Bytes

Versions: 6

Compression:

Stored size: 396 Bytes

Contents

require 'couch_potato'

::CouchPotato::Config.database_name = 'couch_potato_test'

class Widget
  include CouchPotato::Persistence
  
  property :name
  view :by_name, :key => :name
  

  # mimic the AR interface used in example_steps

  def self.create!(attrs = {})
    CouchPotato.database.save(self.new)
  end
  
  def self.count
    CouchPotato.database.view(::Widget.by_name).size
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
bitfluent-database_cleaner-0.5.2 examples/lib/couchpotato_models.rb
database_cleaner-0.5.2 examples/lib/couchpotato_models.rb
database_cleaner-0.5.1 examples/lib/couchpotato_models.rb
jonrowe-database_cleaner-0.5.2 examples/lib/couchpotato_models.rb
saimonmoore-database_cleaner-0.5.0 examples/lib/couchpotato_models.rb
database_cleaner-0.5.0 examples/lib/couchpotato_models.rb