Sha256: 8f283367b39c2de1a08686a905d2a190572cbf0bab9f34dccb594fdfee9b56db

Contents?: true

Size: 748 Bytes

Versions: 7

Compression:

Stored size: 748 Bytes

Contents

module AccessFixtureTestPatches
    extend ActiveSupport::Concern

    included do
        alias_method_chain :table_rows, :custom_autoset_user_fields
    end

    def table_rows_with_custom_autoset_user_fields
        results = table_rows_without_custom_autoset_user_fields
        if model_class && model_class < ActiveRecord::Base && model_class.record_modifications
            results[ table_name ].each do | row |
                row['created_by_id'] = 593363170 if model_class.column_names.include?('created_by_id')
                row['updated_by_id'] = 593363170 if model_class.column_names.include?('updated_by_id')
            end
        end
        results
    end
end

ActiveRecord::FixtureSet.send :include, AccessFixtureTestPatches

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lanes-0.5.6 lib/lanes/access/test_fixture_extensions.rb
lanes-0.5.5 lib/lanes/access/test_fixture_extensions.rb
lanes-0.5.0 lib/lanes/access/test_fixture_extensions.rb
lanes-0.4.0 lib/lanes/access/test_fixture_extensions.rb
lanes-0.3.0 lib/lanes/access/test_fixture_extensions.rb
lanes-0.1.9.5 lib/lanes/access/test_fixture_extensions.rb
lanes-0.1.9 lib/lanes/access/test_fixture_extensions.rb