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

Remove multi_json as dependency in favor of std-lib json #213

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1']
rails: ['6.1', '7.0', 'edge']
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
rails: ['6.1', '7.0', '7.1', 'edge']
exclude:
- ruby: '2.7'
rails: 'edge'
- ruby: '3.0'
rails: 'edge'
env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
Expand Down
1 change: 0 additions & 1 deletion activerecord-session_store.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Gem::Specification.new do |s|
s.add_dependency('actionpack', '>= 6.1')
s.add_dependency('railties', '>= 6.1')
s.add_dependency('rack', '>= 2.0.8', '< 4')
s.add_dependency('multi_json', '~> 1.11', '>= 1.11.2')
s.add_dependency('cgi', '>= 0.3.6')

s.add_development_dependency('sqlite3')
Expand Down
8 changes: 8 additions & 0 deletions gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source "https://rubygems.org"

gem "actionpack", github: "rails/rails", branch: "7-1-stable"
gem "activerecord", github: "rails/rails", branch: "7-1-stable"
gem "railties", github: "rails/rails", branch: "7-1-stable"
gem "rack", ">= 2.2.4", "< 4"

gemspec :path => "../"
6 changes: 3 additions & 3 deletions lib/active_record/session_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'active_record/session_store/version'
require 'action_dispatch/session/active_record_store'
require 'active_support/core_ext/hash/keys'
require 'multi_json'
require 'json'

module ActiveRecord
module SessionStore
Expand Down Expand Up @@ -62,12 +62,12 @@ def self.dump(value)
# Uses built-in JSON library to encode/decode session
class JsonSerializer
def self.load(value)
hash = MultiJson.load(value)
hash = JSON.load(value)
hash.is_a?(Hash) ? hash.with_indifferent_access[:value] : hash
end

def self.dump(value)
MultiJson.dump(value: value)
JSON.dump(value: value)
end
end

Expand Down
Loading