Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/codecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
codecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.3
bundler-cache: true
- run: bundle exec rubocop
27 changes: 21 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,35 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ruby: [2.5, 2.6, 2.7]
runs-on: ${{ matrix.os }}
ruby: ['3.1', '3.2', '3.3', '3.4', '4.0']
rails: ['6.1', '7.0']
mongoid: ['7.5', '8.1']
exclude:
# Rails 6.1 doesn't support Ruby 3.4 or later.
- ruby: '3.4'
rails: '6.1'
- ruby: '4.0'
rails: '6.1'
# ubuntu-latest (26.04) can't compile native extensions against Ruby 3.2's headers.
runs-on: ubuntu-24.04
name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}, Mongoid ${{ matrix.mongoid }}
env:
RAILS_VERSION: ${{ matrix.rails }}
MONGOID_VERSION: ${{ matrix.mongoid }}

services:
mongodb:
image: mongo
image: mongo:7
ports:
- 27017:27017

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
# Not setup-ruby's bundler-cache: it locks the Gemfile without this job's RAILS_VERSION and
# MONGOID_VERSION. setup-ruby still writes that default lockfile, and moving it to this job's
# versions can fail to resolve, so resolve from scratch.
- run: rm -f Gemfile.lock && bundle install
- run: bundle exec rake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ spec/reports
/test_app/config/mongoid.yml
/spec/rails
.ruby-version
Gemfile.lock
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

## 2.0.0

Supports Ruby 3.1+, Rails 6.1 and 7.0, Mongoid 7 and 8, and ActiveAdmin 2.x. Use 1.0.0 for older
versions.

### Breaking changes

* Requires Ruby 3.1 or later, Mongoid 7.0 or later, and ActiveAdmin 2.x.
* `build_new_resource` no longer passes `resource_params` to the build method. ActiveAdmin assigns
them right after building, so they were being assigned twice.

### Fixes

* Rails 7.0: the resource controller patch is applied in `to_prepare`, since Rails 7 doesn't autoload
during initialization.
* ActiveAdmin 2.14: CSV export no longer goes through `in_paginated_batches`, which needs
ActiveRecord. Like it, the export skips the query cache.
* Ruby 3: CSV options are passed as keyword arguments.
* Select filters search the key the document stores, so filters on `belongs_to` and
`has_and_belongs_to_many` associations work.
* `has_many` and `has_one` associations are no longer default filters, since their keys are in the
related documents. Declaring one explicitly raises an error that says so.
* The index page's "Displaying X - Y" counts the current page in the database instead of loading
documents (and no longer counts the whole collection).
* `primary_key` works for subclasses of a document.
* Declares the `csv` dependency, which Ruby 3.4 no longer installs by default.
15 changes: 7 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ source 'https://rubygems.org'

gemspec

gem 'ransack-mongoid', git: 'https://github.com/activerecord-hackery/ransack-mongoid'
# ransack-mongoid 0.x was never released to RubyGems. Pinned to the last commit that supports
# ransack 2.x, which ActiveAdmin 2 requires.
gem 'ransack-mongoid', git: 'https://github.com/riverock/ransack-mongoid', ref: 'f83ae55ea67fc0a0bca30158f3e04c49362f4464'

gem 'rails', '>= 5.2', '< 6.1'

gem 'devise'

gem 'pry-rails'
# CI picks the versions; see .github/workflows/tests.yml.
gem 'rails', "~> #{ENV.fetch('RAILS_VERSION', '7.0')}.0"
gem 'mongoid', "~> #{ENV.fetch('MONGOID_VERSION', '8.1')}.0"

gem 'devise', '~> 4.0' # ActiveAdmin 2 requires < 5
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jslint'

group :test do
gem 'capybara'
gem 'poltergeist'
gem 'launchy'
gem 'simplecov', require: false
end
Expand Down
Loading
Loading