Sha256: 99383a91d59480b868a574e6dad969658165befb2d5cd2e8ead5fba8a336e501

Contents?: true

Size: 1.1 KB

Versions: 13

Compression:

Stored size: 1.1 KB

Contents

# Author: Stephen Sykes
# http://pennysmalls.com

class Product < ActiveRecord::Base
  
  def self.create_product_table
    ActiveRecord::Base.connection.drop_table(:products) rescue ActiveRecord::StatementInvalid
    ActiveRecord::Base.connection.create_table(:products) do |t|
      t.column :name, :string, :limit => 60
      t.column :created_at, :datetime
      t.column :number, :integer
      t.column :nil_test, :string
      t.column :comment, :text
    end
  end

  def self.create_large_product_table
    ActiveRecord::Base.connection.drop_table(:products) rescue ActiveRecord::StatementInvalid
    ActiveRecord::Base.connection.create_table(:products) do |t|
      t.column :name, :string, :limit => 60
      t.column :created_at, :datetime
      t.column :number, :integer
      t.column :nil_test, :string
      t.column :comment, :text
      40.times {|n| t.column "test_col_#{n}", :string}
    end
  end


  def self.make_some_products
    100.times do |n|
      Product.create(:name=>"product_#{n}", :number=>n, :comment=>"Made by the test suite")
    end
  end
  
  def attributes_iv
    @attributes
  end

end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
ghazel-slim-attributes-0.6.3.1 test/products.rb
sdsykes-slim-attributes-0.6.2 test/products.rb
sdsykes-slim-attributes-0.6.3 test/products.rb
sdsykes-slim-attributes-0.6.4 test/products.rb
sdsykes-slim-attributes-0.6.6 test/products.rb
slim-attributes-0.7.7 test/products.rb
ghazel-slim-attributes-0.7.6.1 test/products.rb
slim-attributes-0.7.6 test/products.rb
slim-attributes-0.7.5 test/products.rb
slim-attributes-0.7.4 test/products.rb
slim-attributes-0.7.1 test/products.rb
slim-attributes-0.6.6 test/products.rb
slim-attributes-0.6.4 test/products.rb