I have recently updated to rails gem: 2.2.2 and am getting an error
when datetime_select or a plugin using datetime_select
(unobtrusive_datetime_picker - GitHub - brianjlandau/unobtrusive_date_picker: NO LONGER MAINTAINED)
The update is using the basic query and update based on parameters
submited
@tour_request = TourRequest.find(params[:id])
@tour_request.update_attributes(params[:tour_request])
and no matter if I use in the view I still get the same error:
<
%=f.unobtrusive_datetime_picker :booked_datetime,:include_blank=>true, :order=>
[:month,:day,:year,:hour,:minute],:minute_step=>5 %>
or
<%=
f.select_datetime :booked_datetime,:minute_step=>5,:include_blank=>true, :order=>
[:month,:day,:year,:hour,:minute] %>
</p>
Any insight into what is causing this error or maybe some experience
as there is a ton I've found but nothing with a definitive solution.
full error with the parameters:
My ugly work around is as follows. Just by passing the rails magic
and building the datetime value on my own in the controller
#work around for broken datetime_select
params[:tour_request][:booked_datetime]=Time.local(
params[:tour_request][:"booked_datetime(1i)"].to_i,
params[:tour_request][:"booked_datetime(2i)"].to_i,
params[:tour_request][:"booked_datetime(3i)"].to_i,
#add read for am/pm
params[:tour_request][:"booked_datetime(7i)"].to_i==-1 ? params
[:tour_request][:"booked_datetime(4i)"].to_i : params[:tour_request]
[:"booked_datetime(4i)"].to_i+12,
params[:tour_request][:"booked_datetime(5i)"].to_i,0,0)
#clean up to avoid multivariable error
params[:tour_request].delete(:"booked_datetime(1i)")
params[:tour_request].delete(:"booked_datetime(2i)")
params[:tour_request].delete(:"booked_datetime(3i)")
params[:tour_request].delete(:"booked_datetime(4i)")
params[:tour_request].delete(:"booked_datetime(5i)")
params[:tour_request].delete(:"booked_datetime(7i)")
I know it is a rusty hammer but hit appears to be hitting nails into
the wood just fine.
Cheers,
Gregg