Sure. here's the model:
http://goo.gl/hHt6X

and then the post method with the horrible work-around when the :temps_vol 
input is blank:

post '/cr_mission' do

  (params[:temps_vol] == "") ? temps_vol="00:00":temps_vol=params[:temps_vol]
  
  flight = Flight.first_or_create({:avatar_id => params[:choix_avatar],
                                   :mission_id => params[:choix_mission]
                                   },
                                  {:monture_id => params[:choix_monture],
                                   :role_id => params[:choix_role],
                                   :temps_vol => temps_vol,
                                   :statut_fin_mission_id => 
params[:choix_statut]
                                   })    
  
  redirect '/cr_mission'  
end


the form can be found here:
http://autruches-staging.herokuapp.com/cr_mission 

ps: sorry for late respond, was AFK for two weeks :)

On Tuesday, September 4, 2012 4:53:29 PM UTC+2, Arthur MM wrote:
>
> it's really bizarre, can you post some code to us ?
>
> 2012/8/19 manu <etab...@gmail.com <javascript:>>
>
>> Yes ain't I the verbose one today :)
>>
>> So I discovered today after much blood and tears that, even if a field is 
>> not required in my model, it will throw an exception if I try to create a 
>> new record where that particular field is empty (when I leave the text 
>> input empty on my form).
>>
>> That seems strange, it can't be right, can it?
>>
>> For now I have a horrible work around where I check if that field is 
>> empty at POST and create a different Model.create statement based on that 
>> check...
>>
>> Could someone please shine some light on me? I must be doing something 
>> wrong here.
>>
>> -M
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "DataMapper" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/datamapper/-/AacDbQKZF98J.
>> To post to this group, send email to datam...@googlegroups.com<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> datamapper+...@googlegroups.com <javascript:>.
>> For more options, visit this group at 
>> http://groups.google.com/group/datamapper?hl=en.
>>
>
>
>
> -- 
> ------------------------------------------
>  1. Notebook para você ficar livre e programar a vontade: R$ 2300
>  2. Curso de Programação/SysAdmin/DBA: R$ 5000
>  3. Pedir a solução pronta para um problema numa lista de discussão: Não 
> tem preço !
>
> E para todas as outras existe RTFM, STFW e  LMGTFY
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/datamapper/-/oSMnIAMrSVAJ.
To post to this group, send email to datamapper@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to