Skip to content

Commit

Permalink
Railties 5.0 + jsonb fix (#3)
Browse files Browse the repository at this point in the history
* Bumping railties allowable version

* support JSONB types

* Add jsonb support explicitly
  • Loading branch information
mehernosh authored and allanbreyes committed Oct 11, 2016
1 parent 616ad16 commit bf850f3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PATH
specs:
activeadmin_json_editor (0.0.6)
ace-rails-ap
railties (>= 3.0, < 5.0)
railties (>= 3.0, < 5.1)

GEM
remote: https://rubygems.org/
Expand Down
2 changes: 1 addition & 1 deletion activeadmin_json_editor.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |spec|

spec.required_rubygems_version = '>= 1.3.6'
spec.add_development_dependency 'bundler', '~> 1.5'
spec.add_dependency 'railties', '>= 3.0', '< 5.0'
spec.add_dependency 'railties', '>= 3.0', '< 5.1'
# spec.add_development_dependency "rake", "~> 0"
# spec.add_dependency "active_admin", "~> 1.0.0"
spec.add_dependency 'ace-rails-ap'
Expand Down
2 changes: 1 addition & 1 deletion lib/activeadmin/resource_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def json_editor
before_save do |object, _args|
request_namespace = object.class.name.underscore.tr('/', '_')
if params.key? request_namespace
object.class.columns_hash.select { |_key, attr| attr.type == :json }.keys.each do |key|
object.class.columns_hash.select { |_key, attr| attr.type.in? [:json, :jsonb] }.keys.each do |key|
next unless params[request_namespace].key? key
json_data = params[request_namespace][key]
data = if json_data == 'null' || json_data.blank?
Expand Down

0 comments on commit bf850f3

Please sign in to comment.