vendredi 29 avril 2016

How to change calender structure and save multple dates

When i add multiple dates with 'input' field i'm getting. First i got error like this "undefined method `map' for "translation missing: de.date.order":String"

so that in my locales i added like this

`de:
 date: #Throws an exception otherwise.
    order:
      - "year"
      - "month"
      - "day"'

so that error disappered ,and data is saving to database and calender came like this structure.

enter image description here

Because of this i changed 'input' to 'text_field' , so that calender is coming perfect like this enter image description here

but data is not saving to database. then where i made the error.

PLease Help.i need to change the calender struture and data also need to be stored in database

my model

class Property < ActiveRecord::Base has_many :property_dates accepts_nested_attributes_for :property_dates, allow_destroy: true end

    class PropertyDate < ActiveRecord::Base
        belongs_to :property
    end`

                                           
                                           
<%= f.input :property_dates, required: true,label:false,:class=>"upload imgUpload" %>
 <%= f.simple_fields_for :property_dates do |i| %>
               <%= i.input :start_date%>
               <%= i.input :end_date%>
<% end %>
<%= f.link_to_add 'Add Date', :property_dates, class: 'btn btn-primary', data: {target: '.additional-dates-images'} %>

Aucun commentaire:

Enregistrer un commentaire