Skip to content

Commit

Permalink
Remove multi_json and replace with StdLib JSON
Browse files Browse the repository at this point in the history
Fix: #213
  • Loading branch information
otherguy authored and byroot committed Sep 4, 2024
1 parent 734c38f commit 536716a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
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
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.parse(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

0 comments on commit 536716a

Please sign in to comment.