Sha256: 05c68da5df4510a4e63ccd0e25541e69b8767d82311bee04a4d649ef1aaede25
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
FactoryGirl.define do factory :account do |f| f.name "Account Name Here" end factory :account_with_customer_dynamic_columns, parent: :account do before(:create, :build) do |account| # Setup dynamic fields for Customer under this account account.activerecord_dynamic_columns.build(:dynamic_type => "Customer", :key => "first_name", :data_type => "string") account.activerecord_dynamic_columns.build(:dynamic_type => "Customer", :key => "last_name", :data_type => "string") account.activerecord_dynamic_columns.build(:dynamic_type => "Customer", :key => "email", :data_type => "string") account.activerecord_dynamic_columns.build(:dynamic_type => "Customer", :key => "trusted", :data_type => "boolean") account.activerecord_dynamic_columns.build(:dynamic_type => "Customer", :key => "last_contacted", :data_type => "datetime") account.activerecord_dynamic_columns.build(:dynamic_type => "Customer", :key => "total_purchases", :data_type => "integer") end end factory :account_with_product_dynamic_columns, parent: :account do before(:create, :build) do |account| # Product fields account.activerecord_dynamic_columns.build(:dynamic_type => "Product", :key => "rarity", :data_type => "string") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
has_dynamic_columns-0.3.3 | spec/factories/account.rb |
has_dynamic_columns-0.3.2 | spec/factories/account.rb |