with your method I can have the message error on each record  ?  (for 
example if the date already exist)

Le mardi 24 janvier 2017 12:51:54 UTC+1, Sergio Cambra a écrit :
>
> El lunes, 23 de enero de 2017 16:56:05 (CET) Gloufy escribió: 
> > Hi, 
> > 
> > I have a model called Indispo with a attribute :dateIndispo (is type 
> date) 
> > In my controller i have a custom action periode. 
> > One field for date begin and another field date end. 
> > It possible to create all record between the two date with batch_create 
> ? 
>
>
> I don't think you need batch_create for this, you have your own custom 
> action, 
> so you can call do_create for each date: 
>
>   def periode_create 
>     params[:record][:date_begin]=params[:record][:dateIndispo] if 
> params[:record][:date_end]=="" 
>
>     date_debut=Date.strptime(params[:record][:dateIndispo],'%d/%m/%Y') 
>     date_fin=Date.strptime(params[:record][:date_end],'%d/%m/%Y') 
>
>     params[:record]=[] 
>     date_debut.upto(date_fin) do |date| 
>       do_create attributes: params[:record].merge(:dateIndispo) => 
> date.to_s 
>     end 
>   end 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to