From 32cd54153c94a68f524a5d2f586f7ec268ea6128 Mon Sep 17 00:00:00 2001 From: Bunnydu Date: Thu, 23 Jun 2016 10:07:31 +0800 Subject: [PATCH] bugfix: form_value use enum value not the key in active_record --- lib/rails_admin/config/fields/types/active_record_enum.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/rails_admin/config/fields/types/active_record_enum.rb b/lib/rails_admin/config/fields/types/active_record_enum.rb index 04ec571944..b464f8b35b 100644 --- a/lib/rails_admin/config/fields/types/active_record_enum.rb +++ b/lib/rails_admin/config/fields/types/active_record_enum.rb @@ -34,6 +34,14 @@ def parse_value(value) def parse_input(params) params[name] = parse_value(params[name]) if params[name] end + + def form_default_value + enum[super] + end + + def form_value + enum[super] + end end end end