Module: ActiveFedora::Attributes::Serializers
- Defined in:
 - lib/active_fedora/attributes/serializers.rb
 
Instance Method Summary collapse
- 
  
    
      #attributes=(params)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
set a hash of attributes on the object.
 - 
  
    
      #deserialize_dates_from_form(params)  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    
This allows you to use date_select helpers in rails views.
 
Instance Method Details
#attributes=(params) ⇒ Object
set a hash of attributes on the object
      23 24 25  | 
    
      # File 'lib/active_fedora/attributes/serializers.rb', line 23 def attributes=(params) super(deserialize_dates_from_form(params)) end  | 
  
#deserialize_dates_from_form(params) ⇒ Hash
This allows you to use date_select helpers in rails views
      7 8 9 10 11 12 13 14 15 16 17 18 19  | 
    
      # File 'lib/active_fedora/attributes/serializers.rb', line 7 def deserialize_dates_from_form(params) dates = {} params.each do |key, value| next unless data = key.to_s.match(/^(.+)\((\d)i\)$/) dates[data[1]] ||= {} dates[data[1]][data[2]] = value params.delete(key) end dates.each do |key, value| params[key] = [value['1'], value['2'], value['3']].join('-') end params end  |