File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
module ActiveAdmin
2
2
module HstoreEditor
3
- VERSION = "0.0.1 "
3
+ VERSION = "0.0.2 "
4
4
end
5
5
end
Original file line number Diff line number Diff line change @@ -5,8 +5,13 @@ module ActiveAdmin
5
5
class ResourceDSL
6
6
def hstore_editor
7
7
before_save do |object , args |
8
- object . class . columns_hash . select { |key , attr | attr . type == :hstore } . keys . each do |key |
9
- object . attributes = { key => JSON . parse ( params [ object . class . name . underscore ] [ key ] ) } if params [ object . class . name . underscore ] . key? key
8
+ request_namespace = object . class . name . underscore
9
+ if params . key? request_namespace
10
+ object . class . columns_hash . select { |key , attr | attr . type == :hstore } . keys . each do |key |
11
+ object . attributes = { key => JSON . parse ( params [ request_namespace ] [ key ] ) } if params [ request_namespace ] . key? key
12
+ end
13
+ else
14
+ raise ActionController ::ParameterMissing , request_namespace
10
15
end
11
16
end
12
17
end
You can’t perform that action at this time.
0 commit comments