Sha256: d4a451e1d3ef862d7234dac564dd90a4798e6a16740fab990dd5af02f614d01c

Contents?: true

Size: 841 Bytes

Versions: 15

Compression:

Stored size: 841 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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
protector-0.5.4 migrations/active_record.rb
protector-0.5.3 migrations/active_record.rb
protector-0.5.2 migrations/active_record.rb
protector-0.5.1 migrations/active_record.rb
protector-0.4.1 migrations/active_record.rb
protector-0.4.0 migrations/active_record.rb
protector-0.3.3 migrations/active_record.rb
protector-0.3.2 migrations/active_record.rb
protector-0.3.1 migrations/active_record.rb
protector-0.3.0 migrations/active_record.rb
protector-0.3.0.beta.2 migrations/active_record.rb
protector-0.2.4 migrations/active_record.rb
protector-0.2.3 migrations/active_record.rb
protector-0.2.2 migrations/active_record.rb
protector-0.2.1 migrations/active_record.rb