You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure of the root cause of the change of behavior but RailsAdmin uses a ActionController::Parameters instance to set object's attributes. And since ActionController::Parameters is a subclass of Hash, Psych seems to add ivars and parameters to hashes before a dump to string.
I applied a patch that seems to fix the issue. It consists in transforming params (ActionController::Parameters) to a Hash, before setting object's attributes and saving it.
In https://github.com/sferik/rails_admin/blob/master/lib/rails_admin/config/actions/edit.rb
Line 27
I think I'm having the same issue, but I'm using store_accessor to access some of the values in the hash and often the added information messes with the structure and thus returning nil when I make a call to one of the store_accessors I created.
Thanks @fgi for digging into this, hopefully I can at least use what you've shown here for a patch to get me by for now.
I'm available to help test any solution for this down the road. Thanks!
danstutzman
pushed a commit
to danstutzman/rails_admin
that referenced
this issue
Jun 18, 2017
For example, text_messages and announcements are changed to begin with '--- !ruby/hash-with-ivars:ActionController::Parameters'. Patch is from railsadminteam#2645
In an ActiveRecord model I have fields like
serialize :metas, Hash
They are converted in YAML and stored in PostgreSQL text fields.
Probably since gems upgrades, updates of such fields added useless additional information in the DB.
Example:
Became:
This additional information is irrelevant and generates other problems in my context.
My configuration:
MRI Ruby 2.3.1
rails 4.2.6
rails_admin 0.8.1
psych 2.0.17
After digging for a while, I understood that:
I'm not sure of the root cause of the change of behavior but RailsAdmin uses a ActionController::Parameters instance to set object's attributes. And since ActionController::Parameters is a subclass of Hash, Psych seems to add ivars and parameters to hashes before a dump to string.
I applied a patch that seems to fix the issue. It consists in transforming
params
(ActionController::Parameters) to a Hash, before setting object's attributes and saving it.In
https://github.com/sferik/rails_admin/blob/master/lib/rails_admin/config/actions/edit.rb
Line 27
I'm not sure if disabling ActionController::Parameters filters would be a security issue. In my case, these are hashes of raw data, not Ruby objects.
What would be the right way to properly solve this issue?
Thanks.
The text was updated successfully, but these errors were encountered: