Sha256: e662018e477a58b26da4c419e1a6a3fb5874972d902d547374591d67174ba09b

Contents?: true

Size: 879 Bytes

Versions: 14

Compression:

Stored size: 879 Bytes

Contents

### Connection

ActiveRecord::Schema.verbose = false
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"

ActiveRecord::Base.instance_eval do
  unless method_defined?(:none)
    def none
      where('1 = 0')
    end
  end

  def every
    where(nil)
  end
end

### Tables

[:dummies, :fluffies, :bobbies].each do |m|
  ActiveRecord::Migration.create_table m do |t|
    t.string      :string
    t.integer     :number
    t.text        :text
    t.belongs_to  :dummy
  end
end

ActiveRecord::Migration.create_table(:loonies){|t| t.belongs_to :fluffy; t.string :string }

### Classes

class Dummy < ActiveRecord::Base
  has_many :fluffies
  has_many :bobbies
end

class Fluffy < ActiveRecord::Base
  belongs_to :dummy
  has_one :loony
end

class Bobby < ActiveRecord::Base
end

class Loony < ActiveRecord::Base
end

class Rumba < ActiveRecord::Base
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
protector-0.7.7 migrations/active_record.rb
protector-0.7.6 migrations/active_record.rb
protector-0.7.4 migrations/active_record.rb
protector-0.7.3 migrations/active_record.rb
protector-0.7.2 migrations/active_record.rb
protector-0.7.1 migrations/active_record.rb
protector-0.7.0 migrations/active_record.rb
protector-0.6.4 migrations/active_record.rb
protector-0.6.3 migrations/active_record.rb
protector-0.6.2 migrations/active_record.rb
protector-0.6.1 migrations/active_record.rb
protector-0.6.0 migrations/active_record.rb
protector-0.6.0.beta.1 migrations/active_record.rb
protector-0.5.5 migrations/active_record.rb