Sha256: 7dcf15dc44820567567837725118a2b9a19f94e6d0d4fbbbe8b3348a7e6bfd1a

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

require 'active_record'
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'

ActiveRecord::Schema.define do
  create_table :people do |t|
    t.string :name, :surname, :sex, :profession
    t.date :birthday
  end
end

class Person < ActiveRecord::Base
   scope :male_scope,   where(:sex => 'm')
   scope :female_scope, where(:sex => 'f')
end

module Persons
  Max  = Person.create :name => 'Max',    :surname => 'Kid',   :birthday => Date.new(2003,1,1), :sex => 'm', :profession => 'student'
  Tina = Person.create :name => 'Tina',   :surname => 'Child', :birthday => Date.new(2002,1,1), :sex => 'f', :profession => 'student'
  Joe  = Person.create :name => 'Joe',    :surname => 'Teen',  :birthday => Date.new(1995,1,1), :sex => 'm', :profession => 'student'
  Dick = Person.create :name => 'Dick',   :surname => 'Teeny', :birthday => Date.new(1996,1,1), :sex => 'm', :profession => 'student'
  Dana = Person.create :name => 'Dana',   :surname => 'Twen',  :birthday => Date.new(1985,1,1), :sex => 'f', :profession => 'teacher' 
  John = Person.create :name => 'John',   :surname => 'Twen',  :birthday => Date.new(1985,2,1), :sex => 'm', :profession => 'teacher' 
  Lisa = Person.create :name => 'Lisa',   :surname => 'Adult', :birthday => Date.new(1980,2,1), :sex => 'f', :profession => 'dentist' 
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gitter-1.1.6 spec/support/database.rb
gitter-1.1.5 spec/support/database.rb
gitter-1.1.4 spec/support/database.rb
gitter-1.1.3 spec/support/database.rb