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

Support newer rails and test against it #164

Merged
merged 3 commits into from
Mar 2, 2023
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
9 changes: 5 additions & 4 deletions .github/workflows/test-postgresql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
strategy:
matrix:
entry:
- { ruby: 2.6.2, postgresql: 11 }
- { ruby: 3.1.1, postgresql: 11 }
- { ruby: 3.1.1, postgresql: 14 }
name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }})
- { ruby: 2.6.2, postgresql: 11, active_record: '~> 6.0.0' }
- { ruby: 3.1.1, postgresql: 11, active_record: '~> 6.1.0' }
- { ruby: 3.1.1, postgresql: 14, active_record: '~> 7.0.0' }
name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }}, active_record=${{ matrix.entry.active_record }})
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
Expand All @@ -30,6 +30,7 @@ jobs:
uses: GabrielBB/xvfb-action@v1
env:
DATABASE_ADAPTER: activerecord
ACTIVERECORD_VERSION: ${{ matrix.entry.active_record }}
DATABASE_URL: postgres://test:password@localhost/slack_ruby_bot_server_test
with:
run: |
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
### Changelog

### 2.0.2 (Next)
### 2.1.0 (Next)

* [#163](https://github.com/slack-ruby/slack-ruby-bot-server/pull/163): Updated releasing documentation - [@crazyoptimist](https://github.com/crazyoptimist).
* [#164](https://github.com/slack-ruby/slack-ruby-bot-server/pull/164): Support rails 6.1 and 7.0 and test against it - [@maths22](https://github.com/maths22).
* Your contribution here.

#### 2.0.1 (2023/02/20)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ when 'mongoid' then
gem 'mongoid-scroll'
gem 'mongoid-shell'
when 'activerecord' then
gem 'activerecord', '~> 6.0.0'
gem 'activerecord', ENV['ACTIVERECORD_VERSION'] || '~> 6.0.0'
gem 'otr-activerecord'
gem 'pagy_cursor'
gem 'pg'
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ gem 'slack-ruby-bot-server'
#### ActiveRecord

Use ActiveRecord with, for example, PostgreSQL via [pg](https://github.com/ged/ruby-pg). Add the `activerecord`, `pg`, `otr-activerecord` and `pagy_cursor` gems to your Gemfile.
Currently supports ActiveRecord/Rails major versions 6.0, 6.1 and 7.0.

```
gem 'pg'
Expand Down
2 changes: 1 addition & 1 deletion lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class TeamsEndpoint < Grape::API
if team
team.ping_if_active!

team.update_attributes!(
team.update!(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only substantive change of this PR. update_attribute! has been an alias to update! since rails 4.0 and was finally deprecated in rails 6.1 and dropped in rails 7.0

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!

oauth_version: oauth_version,
oauth_scope: oauth_scope,
activated_user_id: user_id,
Expand Down
4 changes: 2 additions & 2 deletions lib/slack-ruby-bot-server/models/team/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ module Methods
validates_presence_of :team_id

def deactivate!
update_attributes!(active: false)
update!(active: false)
end

def activate!(token)
update_attributes!(active: true, token: token)
update!(active: true, token: token)
end

def to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/slack-ruby-bot-server/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SlackRubyBotServer
VERSION = '2.0.2'.freeze
VERSION = '2.1.0'.freeze
end