Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions gemfiles/Gemfile.rails-6.0-stable
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec path: ".."

gem "activerecord", github: "rails/rails", branch: "6-0-stable"
74 changes: 74 additions & 0 deletions gemfiles/Gemfile.rails-6.0-stable.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
GIT
remote: https://github.com/rails/rails.git
revision: f64f7c649d7d6c05bd1a0309f6dd3936ff2c4644
branch: 6-0-stable
specs:
activemodel (6.0.3.4)
activesupport (= 6.0.3.4)
activerecord (6.0.3.4)
activemodel (= 6.0.3.4)
activesupport (= 6.0.3.4)
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)

PATH
remote: ..
specs:
polymorphic_integer_type (2.3.1)
activerecord

GEM
remote: https://rubygems.org/
specs:
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.7)
diff-lcs (1.4.4)
i18n (1.8.7)
concurrent-ruby (~> 1.0)
method_source (1.0.0)
minitest (5.14.2)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
rake (13.0.3)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.1)
sqlite3 (1.4.2)
thread_safe (0.3.6)
tzinfo (1.2.9)
thread_safe (~> 0.1)
zeitwerk (2.4.2)

PLATFORMS
ruby

DEPENDENCIES
activerecord!
bundler
polymorphic_integer_type!
pry-byebug
rake
rspec
sqlite3

BUNDLED WITH
2.1.4
7 changes: 7 additions & 0 deletions gemfiles/Gemfile.rails-6.1-stable
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec path: ".."

gem "activerecord", github: "rails/rails", branch: "6-1-stable"
73 changes: 73 additions & 0 deletions gemfiles/Gemfile.rails-6.1-stable.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
GIT
remote: https://github.com/rails/rails.git
revision: 6fb3884ca9dcc08765dc8b7852d8d139b885ca03
branch: 6-1-stable
specs:
activemodel (6.1.0)
activesupport (= 6.1.0)
activerecord (6.1.0)
activemodel (= 6.1.0)
activesupport (= 6.1.0)
activesupport (6.1.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)

PATH
remote: ..
specs:
polymorphic_integer_type (2.3.1)
activerecord

GEM
remote: https://rubygems.org/
specs:
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.1.7)
diff-lcs (1.4.4)
i18n (1.8.7)
concurrent-ruby (~> 1.0)
method_source (1.0.0)
minitest (5.14.2)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
rake (13.0.3)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.1)
sqlite3 (1.4.2)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
zeitwerk (2.4.2)

PLATFORMS
ruby

DEPENDENCIES
activerecord!
bundler
polymorphic_integer_type!
pry-byebug
rake
rspec
sqlite3

BUNDLED WITH
2.1.4
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module PolymorphicArrayValueExtension
# end

def type_to_ids_mapping
association = @associated_table.send(:association)
association_method = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new("6.1.0") ? :reflection : :association
association = @associated_table.send(association_method)
name = association.name
default_hash = Hash.new { |hsh, key| hsh[key] = [] }
values.each_with_object(default_hash) do |value, hash|
Expand Down
2 changes: 1 addition & 1 deletion polymorphic_integer_type.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_dependency "activerecord", "< 6"
spec.add_dependency "activerecord"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
Expand Down
4 changes: 2 additions & 2 deletions spec/polymorphic_integer_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@

context "and when it already has a polymorphic record" do
let(:target) { kibble }
before { link.update_attributes(target: target) }
before { link.update(target: target) }

include_examples "proper source"
include_examples "proper target"
Expand All @@ -178,7 +178,7 @@

context "and when it already has a polymorphic id and type" do
let(:target) { kibble }
before { link.update_attributes(target_id: target.id, target_type: target.class.to_s) }
before { link.update(target_id: target.id, target_type: target.class.to_s) }
include_examples "proper source"
include_examples "proper target"
end
Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
config.before(:suite) do
database_config = YAML.load(File.open("#{File.dirname(__FILE__)}/support/database.yml"))
ActiveRecord::Base.establish_connection(database_config)
if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new("5.2.0")
if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new("6.0.0")
ActiveRecord::MigrationContext.new("#{File.dirname(__FILE__)}/support/migrations", ActiveRecord::Base.connection.schema_migration).migrate
elsif Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new("5.2.0")
ActiveRecord::MigrationContext.new("#{File.dirname(__FILE__)}/support/migrations").migrate
end
end
Expand Down