Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

stopped nullifying blank values, except for passwords. Fix #882

  • Loading branch information...
commit ac0344fc7f52bb3fc55b57dd9d0ec8937e7b7143 1 parent b2c73d5
@bbenezech bbenezech authored
View
2  app/controllers/rails_admin/main_controller.rb
@@ -307,8 +307,6 @@ def get_attributes
if @abstract_model.model.serialized_attributes.keys.include?(key) and value.is_a? String
@attributes[key] = YAML::load(value)
end
- # Delete fields that are blank
- @attributes[key] = nil if value.blank?
end
end
View
2  lib/rails_admin/config/fields/types/date.rb
@@ -15,7 +15,7 @@ class Date < RailsAdmin::Config::Fields::Types::Datetime
}
def parse_input(params)
- params[name] = self.class.normalize(params[name], localized_date_format).to_date if params[name]
+ params[name] = self.class.normalize(params[name], localized_date_format).to_date if params[name].present?
end
end
end
View
2  lib/rails_admin/config/fields/types/datetime.rb
@@ -132,7 +132,7 @@ def meridian_indicator?
end
def parse_input(params)
- params[name] = self.class.normalize(params[name], "#{localized_date_format} #{localized_time_format}") if params[name]
+ params[name] = self.class.normalize(params[name], "#{localized_date_format} #{localized_time_format}") if params[name].present?
end
register_instance_option(:sort_reverse?) do
View
4 lib/rails_admin/config/fields/types/password.rb
@@ -14,6 +14,10 @@ class Password < RailsAdmin::Config::Fields::Types::String
def self.column_names
@column_names
end
+
+ def parse_input(params)
+ params[name] = params[name].presence
+ end
register_instance_option :formatted_value do
"".html_safe
View
2  lib/rails_admin/config/fields/types/time.rb
@@ -18,7 +18,7 @@ class Time < RailsAdmin::Config::Fields::Types::Datetime
RailsAdmin::Config::Fields::Types::register(self)
def parse_input(params)
- params[name] = self.class.normalize(params[name], localized_time_format) if params[name]
+ params[name] = self.class.normalize(params[name], localized_time_format) if params[name].present?
end
# Parse normalized date (time) strings using UTC
Please sign in to comment.
Something went wrong with that request. Please try again.