Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into sti
Browse files Browse the repository at this point in the history
  • Loading branch information
doits committed Jun 15, 2021
2 parents f831526 + c0f9d36 commit fbbb9f2
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 55 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/activerecord.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: activerecord
on: [push]
jobs:
ubuntu:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
gemfile: [activerecord_4, activerecord_5, activerecord_6]
ruby: [2.5.7, 2.6.5, 2.7.2]
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
ADAPTER: active_record
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: sudo apt-get install -y libsqlite3-dev
- run: gem update --system
- run: gem install bundler
- run: gem --version
- run: bundle install
- name: Run Tests
run: |
bundle exec rake
32 changes: 32 additions & 0 deletions .github/workflows/mongoid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: mongoid
on: [push]
jobs:
ubuntu:
runs-on: ubuntu-latest
continue-on-error: true
services:
mongodb:
image: mongo:3.4.23
ports:
- 27017:27017
strategy:
matrix:
gemfile: [mongoid_5]
ruby: [2.5.7, 2.6.5, 2.7.2]
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
ADAPTER: mongoid
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: sudo apt-get install -y libsqlite3-dev
- run: gem update --system
- run: gem install bundler
- run: gem --version
- run: bundle install
- name: Run Tests
run: |
bundle exec rake
52 changes: 0 additions & 52 deletions .travis.yml

This file was deleted.

11 changes: 11 additions & 0 deletions CHANGELOG.rdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
= 6.0.0 (April 2, 2021)

Breaking changes:

* Support strict <tt>with_role</tt> queries. Note this changes behaviour of with_role when running in strict mode to behave as previously documented. #543 describes the behaviour change.
* Dropped support for Ruby 2.3 and 2.4

Improvements:

* Updated ActiveRecord adapters implementation of <tt>in</tt> to utilise a subquery instead of two queries

= 5.3.0 (June 1, 2020)

5.3.0 will be the last version to support Ruby < 2.5 and Rails < 5.2. Support for these will be dropped in the next major release.
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RSpec::Core::RakeTask.new(:rolify) do |task|
task.pattern = 'spec/rolify/**/*_spec.rb'
end

if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
if !ENV["APPRAISAL_INITIALIZED"] && !ENV["CI"]
task :default => :appraisal
else
task :default => [ :spec, 'coveralls:push' ]
Expand Down
2 changes: 1 addition & 1 deletion lib/rolify/adapters/active_record/resource_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def resources_find(roles_table, relation, role_name)
end

def in(relation, user, role_names)
roles = user.roles.where(:name => role_names).select("#{quote_table(role_class.table_name)}.#{quote_column(role_class.primary_key)}").to_a
roles = user.roles.where(:name => role_names).select("#{quote_table(role_class.table_name)}.#{quote_column(role_class.primary_key)}")
relation.where("#{quote_table(role_class.table_name)}.#{quote_column(role_class.primary_key)} IN (?) AND ((#{quote_table(role_class.table_name)}.resource_id = #{quote_table(relation.table_name)}.#{quote_column(relation.primary_key)}) OR (#{quote_table(role_class.table_name)}.resource_id IS NULL))", roles)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rolify/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Rolify
VERSION = "5.3.0"
VERSION = "6.0.0"
end

0 comments on commit fbbb9f2

Please sign in to comment.