Sha256: 6d9e450ce6276febdfcab29d952ca931db14e1d643d8b0bd4298ed8a39de57b2

Contents?: true

Size: 736 Bytes

Versions: 30

Compression:

Stored size: 736 Bytes

Contents

require 'ohm'

Ohm.connect :url => ENV['REDIS_URL']

class OhmWidget < Ohm::Model
  attribute :name

  def self.create!(attrs = {})
    new({:name => 'some widget'}.merge(attrs)).save
  end

  def self.count
    all.count
  end

end

class OhmWidgetUsingDatabaseOne < Ohm::Model
  connect :url => ENV['REDIS_URL_ONE']
  attribute :name

  def self.create!(attrs = {})
    new({:name => 'a widget using database one'}.merge(attrs)).save
  end

  def self.count
    all.count
  end

end

class OhmWidgetUsingDatabaseTwo < Ohm::Model
  connect :url => ENV['REDIS_URL_TWO']
  attribute :name

  def self.create!(attrs = {})
    new({:name => 'a widget using database two'}.merge(attrs)).save
  end

  def self.count
    all.count
  end
end

Version data entries

30 entries across 25 versions & 4 rubygems

Version Path
database_cleaner-1.6.2 examples/lib/ohm_models.rb
database_cleaner-1.6.1 examples/lib/ohm_models.rb
database_cleaner-1.6.0 examples/lib/ohm_models.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/examples/lib/ohm_models.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/examples/lib/ohm_models.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/examples/lib/ohm_models.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/examples/lib/ohm_models.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/examples/lib/ohm_models.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/examples/lib/ohm_models.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/examples/lib/ohm_models.rb
database_cleaner-1.5.3 examples/lib/ohm_models.rb
database_cleaner-1.5.2 examples/lib/ohm_models.rb
database_cleaner-1.5.1 examples/lib/ohm_models.rb
database_cleaner-1.5.0 examples/lib/ohm_models.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/database_cleaner-1.4.1/examples/lib/ohm_models.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/database_cleaner-1.4.1/examples/lib/ohm_models.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/database_cleaner-1.4.1/examples/lib/ohm_models.rb
database_cleaner-1.4.1 examples/lib/ohm_models.rb
database_cleaner-1.4.0 examples/lib/ohm_models.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/examples/lib/ohm_models.rb