some AR and processor updates
This commit is contained in:
parent
59e8bd2eb3
commit
3223b019eb
@ -2,10 +2,8 @@ require 'formtastic-separate_html5_date_and_time/processor'
|
||||
|
||||
module ActiveRecord
|
||||
module ProcessSeparateDateAndTimePickerInputs
|
||||
def assign_multiparameter_attributes(attrs)
|
||||
Formtastic::SeparateDateAndTimePickerInput::Processor.process(attrs).each do |attribute, value|
|
||||
public_send("#{attribute}=", value)
|
||||
end
|
||||
def assign_attributes(attrs = nil, *args)
|
||||
super Formtastic::SeparateDateAndTimePickerInput::Processor.process(attrs), *args
|
||||
end
|
||||
|
||||
def update_attributes(attrs = nil)
|
||||
@ -13,3 +11,4 @@ module ActiveRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -15,7 +15,13 @@ module Formtastic
|
||||
end
|
||||
|
||||
datetime_attrs.each do |attr, values|
|
||||
attrs[attr] = values["#{attr}(date)"] + ' ' + values["#{attr}(time)"]
|
||||
if !values["#{attr}(date)"].blank?
|
||||
value = (values["#{attr}(date)"] + ' ' + values["#{attr}(time)"]).strip
|
||||
|
||||
if !value.blank?
|
||||
attrs[attr.to_sym] = value
|
||||
end
|
||||
end
|
||||
|
||||
attrs.delete("#{attr}(date)")
|
||||
attrs.delete("#{attr}(time)")
|
||||
@ -27,3 +33,4 @@ module Formtastic
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user