Sha256: 3f9bb4f1f93f659f1c50770cc7f1e5773d99efe90532fc41935bfabb8c151172
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
require 'active_record' require 'sqlite3' require 'logger' require 'rspec/rails/adapters' require 'rspec/rails/fixture_support' ROOT = File.join(File.dirname(__FILE__), '..') ActiveRecord::Base.logger = Logger.new('tmp/ar_debug.log') ActiveRecord::Base.configurations = YAML::load(IO.read('spec/support/database.yml')) ActiveRecord::Base.establish_connection('development') ActiveRecord::Schema.define :version => 0 do create_table :ducks, :force => true do |t| t.string :name t.integer :row t.integer :size t.integer :age t.string :pond end create_table :wrong_scope_ducks, :force => true do |t| t.string :name t.integer :size t.string :pond end create_table :wrong_field_ducks, :force => true do |t| t.string :name t.integer :age t.string :pond end end class Duck < ActiveRecord::Base include RankedModel ranks :row ranks :size, :scope => :in_shin_pond ranks :age, :with_same => :pond scope :in_shin_pond, where(:pond => 'Shin') end # Negative examples class WrongScopeDuck < ActiveRecord::Base include RankedModel ranks :size, :scope => :non_existant_scope end class WrongFieldDuck < ActiveRecord::Base include RankedModel ranks :age, :with_same => :non_existant_field end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ranked-model-0.0.3 | spec/support/active_record.rb |
ranked-model-0.0.2 | spec/support/active_record.rb |