Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Fix SchemaMigration parent class mismatch for Rails 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
westonganger committed Oct 17, 2023
1 parent 89c9338 commit c19945e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 4 additions & 2 deletions lib/active_record/mass_assignment_security.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ActiveRecord::Base
include ActiveRecord::MassAssignmentSecurity::Inheritance
end

class ActiveRecord::SchemaMigration < ActiveRecord::Base
attr_accessible :version
if ActiveRecord.version <= Gem::Version.new("7.0")
class ActiveRecord::SchemaMigration < ActiveRecord::Base
attr_accessible :version
end
end
8 changes: 1 addition & 7 deletions test/attribute_sanitization_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,7 @@ def test_create_with_bang_with_without_protection_with_attr_protected_attributes
def test_protection_against_class_attribute_writers
attribute_writers = [:logger, :configurations, :primary_key_prefix_type, :table_name_prefix, :table_name_suffix, :pluralize_table_names,
:lock_optimistically, :default_scopes, :connection_handler, :nested_attributes_options,
:attribute_method_matchers, :time_zone_aware_attributes, :skip_time_zone_conversion_for_attributes]

if Rails::VERSION::MAJOR <= 6
attribute_writers += [:default_timezone, :schema_format, :timestamped_migrations]
end

attribute_writers.push(:_attr_readonly) if ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 0
:time_zone_aware_attributes, :skip_time_zone_conversion_for_attributes]

attribute_writers.each do |method|
assert_respond_to Task, method
Expand Down

0 comments on commit c19945e

Please sign in to comment.