Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop old rails support #929

Merged
Merged
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: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ env:
- RAILS=v5.2.0 DB=mysql
- RAILS=v5.2.0 DB=postgres

- RAILS=5-1-stable DB=sqlite3
- RAILS=5-1-stable DB=mysql
- RAILS=5-1-stable DB=postgres

- RAILS=5-0-stable DB=sqlite3
- RAILS=5-0-stable DB=mysql
- RAILS=5-0-stable DB=postgres

- RAILS=4-2-stable DB=sqlite3
- RAILS=4-2-stable DB=mysql
- RAILS=4-2-stable DB=postgres
matrix:
allow_failures:
- env: RAILS=5-2-stable DB=sqlite3
Expand Down
21 changes: 4 additions & 17 deletions lib/polyamorous.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,15 @@ module Polyamorous
require 'polyamorous/swapping_reflection_class'

ar_version = ::ActiveRecord::VERSION::STRING[0,3]
ar_version = '3_and_4.0' if ar_version < '4.1'
ar_version = ::ActiveRecord::VERSION::STRING[0,5] if ar_version == '5.2'

method, ruby_version =
if RUBY_VERSION >= '2.0' && ar_version >= '4.1'
# Ruby 2; we can use `prepend` to patch Active Record cleanly.
[:prepend, '2']
else
# Ruby 1.9; we must use `alias_method` to patch Active Record.
[:include, '1.9']
end

%w(join_association join_dependency).each do |file|
require "polyamorous/activerecord_#{ar_version}_ruby_#{ruby_version}/#{file}"
require "polyamorous/activerecord_#{ar_version}_ruby_2/#{file}"
end

Polyamorous::JoinDependency.send(method, Polyamorous::JoinDependencyExtensions)
if method == :prepend
Polyamorous::JoinDependency.singleton_class
.send(:prepend, Polyamorous::JoinDependencyExtensions::ClassMethods)
end
Polyamorous::JoinAssociation.send(method, Polyamorous::JoinAssociationExtensions)
Polyamorous::JoinDependency.send(:prepend, Polyamorous::JoinDependencyExtensions)
Polyamorous::JoinDependency.singleton_class.send(:prepend, Polyamorous::JoinDependencyExtensions::ClassMethods)
Polyamorous::JoinAssociation.send(:prepend, Polyamorous::JoinAssociationExtensions)

Polyamorous::JoinBase.class_eval do
if method_defined?(:active_record)
Expand Down

This file was deleted.

96 changes: 0 additions & 96 deletions lib/polyamorous/activerecord_3_and_4.0_ruby_1.9/join_dependency.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/polyamorous/activerecord_4.1_ruby_1.9/join_association.rb

This file was deleted.

4 changes: 0 additions & 4 deletions lib/polyamorous/activerecord_4.1_ruby_1.9/join_dependency.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/polyamorous/activerecord_4.1_ruby_2/join_association.rb

This file was deleted.

3 changes: 0 additions & 3 deletions lib/polyamorous/activerecord_4.1_ruby_2/join_dependency.rb

This file was deleted.

This file was deleted.

46 changes: 0 additions & 46 deletions lib/polyamorous/activerecord_4.2_ruby_1.9/join_association.rb

This file was deleted.

87 changes: 0 additions & 87 deletions lib/polyamorous/activerecord_4.2_ruby_1.9/join_dependency.rb

This file was deleted.

2 changes: 0 additions & 2 deletions lib/polyamorous/activerecord_4.2_ruby_2/join_association.rb

This file was deleted.

Loading