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

Rails 6 patch for the finders add on - plus configuration for travis and Rails 6 #897

Merged
merged 1 commit into from
Feb 24, 2019
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
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