Sha256: cc1bed8297640dcbb9856b4f3a33b6c10ef94db6e38f15320308758da8e20ed3
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
module FixtureHelpers extend ActiveSupport::Concern included do alias_method_chain :table_rows, :custom_autoset_fields end def table_rows_with_custom_autoset_fields results = table_rows_without_custom_autoset_fields if model_class results[ table_name ].each do | row | row['visible_id'] = Lanes::SequentialId.next_for( model_class ) if model_class.column_names.include?('visible_id') row['hash_code' ] = Lanes::Strings.random if model_class.column_names.include?('hash_code') row['created_at'] = Time.now if model_class.column_names.include?('created_at') row['updated_at'] = Time.now if model_class.column_names.include?('updated_at') # 135138680 == "admin" row['created_by_id'] = 135138680 if model_class.column_names.include?('created_by_id') row['updated_by_id'] = 135138680 if model_class.column_names.include?('updated_by_id') end end results end end ActiveRecord::FixtureSet.send :include, FixtureHelpers
Version data entries
4 entries across 4 versions & 1 rubygems