Saving empty strings as nil for all forms in rails admin
565 views
Skip to first unread message
evan
unread,
Jun 10, 2012, 5:37:30 PM6/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rails_admin
Hello Everyone,
Is there an accepted way or hook of some kind that can be used to
force all empty strings for string field types to save as nil when
editing/creating with a rails admin form?
If not could someone point me in the direction where such a config/
hook might be added in the code and I'll give a patch a try. (Rather
new to the code, not sure where a good place to start might be for
hooking into the save process.)
Best,
Evan
evan
unread,
Jun 10, 2012, 6:14:40 PM6/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rails_admin
I ended up using nilify_blanks (https://github.com/rubiety/ nilify_blanks) and applying it to all models as appropriate.