lib/active_data.rb in active_data-1.1.6 vs lib/active_data.rb in active_data-1.1.7
- old
+ new
@@ -59,9 +59,19 @@
case value
when ::Hash then
value
end
end
+ ActiveSupport.on_load :action_controller do
+ ActiveData.typecaster('Hash') do |value|
+ case value
+ when ActionController::Parameters
+ value.to_h if value.permitted?
+ when ::Hash then
+ value
+ end
+ end
+ end
typecaster('Date') do |value|
begin
value.to_date
rescue ArgumentError, NoMethodError
nil