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

Activerecord 6 support #470

Merged
merged 8 commits into from
Apr 22, 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
20 changes: 15 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,33 @@ rvm:
- 2.3.8
- 2.4.5
- 2.5.3
- 2.6.1
- 2.6.3
- jruby-9.1.6.0

env:
matrix:
- RAILS='~> 4.2.0'
- RAILS='~> 5.0.0'
- RAILS='~> 4.2.0' SQLITE_VERSION='~> 1.3.6'
- RAILS='~> 5.0.0' SQLITE_VERSION='~> 1.3.6'
- RAILS='~> 5.1.0'
- RAILS='~> 5.2.0'
- RAILS='master'

matrix:
allow_failures:
- env: RAILS='~> 4.2.0'
- env: RAILS='~> 4.2.0' SQLITE_VERSION='~> 1.3.6'
rvm: jruby-9.1.6.0
- env: RAILS='~> 5.0.0'
- env: RAILS='~> 5.0.0' SQLITE_VERSION='~> 1.3.6'
rvm: jruby-9.1.6.0
- env: RAILS='~> 5.1.0'
rvm: jruby-9.1.6.0
- env: RAILS='~> 5.2.0'
rvm: jruby-9.1.6.0
- env: RAILS='master'
rvm: jruby-9.1.6.0
exclude:
- rvm: 2.2
env: RAILS='master'
- rvm: 2.3.8
env: RAILS='master'
- rvm: 2.4.5
env: RAILS='master'
16 changes: 13 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
source 'https://rubygems.org'

gem 'sqlite3', platforms: [:ruby]
sqlite = ENV['SQLITE_VERSION']

if sqlite
gem 'sqlite3', sqlite, platforms: [:ruby]
else
gem 'sqlite3', platforms: [:ruby]
end

platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter'
end

platforms :rbx do
gem 'rubinius-developer_tools'
gem 'rubysl', '~> 2.0'
gem 'rubysl-test-unit'
gem 'rubinius-developer_tools'
end

rails = ENV['RAILS'] || '~> 5.2.0'

gem 'rails', rails
if rails == 'master'
gem 'rails', github: 'rails/rails'
else
gem 'rails', rails
end

# Specify your gem's dependencies in paranoia.gemspec
gemspec
5 changes: 3 additions & 2 deletions lib/paranoia.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'active_record' unless defined? ActiveRecord

if [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR] == [5, 2]
if [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR] == [5, 2] ||
ActiveRecord::VERSION::MAJOR > 5
require 'paranoia/active_record_5_2'
end

Expand Down Expand Up @@ -305,7 +306,7 @@ def build_relation(klass, *args)
class UniquenessValidator < ActiveModel::EachValidator
prepend UniquenessParanoiaValidator
end

class AssociationNotSoftDestroyedValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
# if association is soft destroyed, add an error
Expand Down
2 changes: 1 addition & 1 deletion paranoia.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |s|

s.required_ruby_version = '>= 2.0'

s.add_dependency 'activerecord', '>= 4.0', '< 5.3'
s.add_dependency 'activerecord', '>= 4.0', '< 6.1'

s.add_development_dependency "bundler", ">= 1.0.0"
s.add_development_dependency "rake"
Expand Down