Skip to content

Commit

Permalink
Merge pull request #897 from jamesjefferies/support-for-active-record-6
Browse files Browse the repository at this point in the history
Rails 6 patch for the finders add on - plus configuration for travis and Rails 6
  • Loading branch information
parndt authored Feb 24, 2019
2 parents a3657cc + cdd5971 commit a605404
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 4 deletions.
44 changes: 41 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
language: ruby
cache: bundler

services:
- postgresql
- mysql
dist: trusty
addons:
postgresql: "9.6"
rvm:
- 2.6.1
- 2.5.3
- 2.4.0
- 2.3.0
- 2.2.0
Expand All @@ -19,6 +26,7 @@ gemfile:
- gemfiles/Gemfile.rails-5.0.rb
- gemfiles/Gemfile.rails-5.1.rb
- gemfiles/Gemfile.rails-5.2.rb
- gemfiles/Gemfile.rails-6.0.rb

before_install:
- gem update bundler
Expand All @@ -27,22 +35,52 @@ matrix:
exclude:
- rvm: 2.1.0
gemfile: gemfiles/Gemfile.rails-5.2.rb
- rvm: 2.1.0
gemfile: gemfiles/Gemfile.rails-6.0.rb
- rvm: 2.2.0
gemfile: gemfiles/Gemfile.rails-5.2.rb
- rvm: 2.2.0
gemfile: gemfiles/Gemfile.rails-6.0.rb
- rvm: jruby-9.1.13.0
gemfile: gemfiles/Gemfile.rails-5.2.rb
- rvm: jruby-9.1.13.0
gemfile: gemfiles/Gemfile.rails-6.0.rb
- rvm: 2.1.0
gemfile: gemfiles/Gemfile.rails-5.0.rb
- rvm: 2.1.0
gemfile: gemfiles/Gemfile.rails-5.1.rb
- rvm: 2.1.0
gemfile: gemfiles/Gemfile.rails-6.0.rb
- rvm: 2.2.0
gemfile: gemfiles/Gemfile.rails-5.1.rb
- rvm: 2.1.0
gemfile: gemfiles/Gemfile.rails-5.0.rb
- rvm: 2.2.0
gemfile: gemfiles/Gemfile.rails-5.0.rb
- rvm: 2.2.0
gemfile: gemfiles/Gemfile.rails-6.0.rb
- rvm: 2.3.0
gemfile: gemfiles/Gemfile.rails-6.0.rb
- rvm: 2.4.0
gemfile: gemfiles/Gemfile.rails-4.0.rb
- rvm: 2.4.0
gemfile: gemfiles/Gemfile.rails-4.1.rb
- rvm: 2.4.0
gemfile: gemfiles/Gemfile.rails-6.0.rb
- rvm: 2.5.3
gemfile: gemfiles/Gemfile.rails-4.0.rb
- rvm: 2.5.3
gemfile: gemfiles/Gemfile.rails-4.1.rb
- rvm: 2.5.3
gemfile: gemfiles/Gemfile.rails-5.0.rb
- rvm: 2.5.3
gemfile: gemfiles/Gemfile.rails-5.1.rb
- rvm: 2.6.1
gemfile: gemfiles/Gemfile.rails-4.0.rb
- rvm: 2.6.1
gemfile: gemfiles/Gemfile.rails-4.1.rb
- rvm: 2.6.1
gemfile: gemfiles/Gemfile.rails-5.0.rb
- rvm: 2.6.1
gemfile: gemfiles/Gemfile.rails-5.1.rb
allow_failures:
- rvm: jruby-9.1.13.0
gemfile: gemfiles/Gemfile.rails-5.1.rb
Expand Down
27 changes: 27 additions & 0 deletions gemfiles/Gemfile.rails-6.0.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
source 'https://rubygems.org'

gemspec path: '../'

gem 'activerecord', '~> 6.0.0.beta1'
gem 'railties', '~> 6.0.0.beta1'

# Database Configuration
group :development, :test do
platforms :jruby do
gem 'activerecord-jdbcmysql-adapter', '~> 51.1'
gem 'activerecord-jdbcpostgresql-adapter', '~> 51.1'
gem 'kramdown'
end

platforms :ruby, :rbx do
gem 'sqlite3'
gem 'mysql2'
gem 'pg'
gem 'redcarpet'
end

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'rubinius-developer_tools'
end
end
2 changes: 1 addition & 1 deletion lib/friendly_id/finders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def relation_delegate_class(klass)
def self.setup(model_class)
model_class.instance_eval do
relation.class.send(:include, friendly_id_config.finder_methods)
if (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2) || ActiveRecord::VERSION::MAJOR == 5
if (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2) || ActiveRecord::VERSION::MAJOR >= 5
model_class.send(:extend, friendly_id_config.finder_methods)
end
end
Expand Down

0 comments on commit a605404

Please sign in to comment.