Skip to content

Commit

Permalink
work out kinks
Browse files Browse the repository at this point in the history
  • Loading branch information
waymondo committed Oct 11, 2024
1 parent 8fcae6a commit 2660b81
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gem "debug"
if (rails_version = ENV["RAILS_VERSION"])
gem "rails", "~> #{rails_version}"
else
gem "rails"
gem "rails", "7.0.8.4"
end
gem "syntax_tree"
gem "typeprof"
Expand Down
6 changes: 2 additions & 4 deletions lib/hoardable/has_one.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ def has_one(*args)
options = args.extract_options!
hoardable = options.delete(:hoardable)
name = args.first
has_one_options = super(*args, **options)[name]&.options
unless hoardable || (has_one_options && has_one_options[:class_name].match?(/RichText$/))
return
end
association = super(*args, **options).symbolize_keys[name]
return unless hoardable || (association.options[:class_name].match?(/RichText$/))

class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{name}
Expand Down
8 changes: 6 additions & 2 deletions test/test_schema_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class TestSchemaDumper < ActiveSupport::TestCase
private def dump_table_schema(*table_names)
connection = ActiveRecord::Base.connection
ActiveRecord::SchemaDumper.ignore_tables = connection.data_sources - table_names
output, = capture_io { ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection_pool) }
output
if ActiveRecord.version >= Gem::Version.new("7.2.1")
output, = capture_io { ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection_pool) }
output
else
ActiveRecord::SchemaDumper.dump(connection, StringIO.new).string
end
end
end

0 comments on commit 2660b81

Please sign in to comment.