Hello I am having trouble with datetime objects, I had the “good” idea
of making a form, asking for the parameters of DateTime and then give
this object to the Database, apparently this is not the way.
I have this error: wrong number of arguments (2 for 1)
And this is what I tried:
I have a model like this
datetime :when
string :where
A view like this
<% form_tag exams_path do %>
Place:
<%= text_field_tag 'place' %>
Date and Hour:
Day: <%= text_field_tag 'day', nil, :size => 4, :maxlength => 2
%>
Month: <%= text_field_tag 'month',nil, :size => 4, :maxlength => 2
%>
year: <%= text_field_tag 'year', nil, :size => 4, :maxlength => 4
%>
Hour: <%= text_field_tag 'hour', nil, :size => 4, :maxlength => 2
%>
Minute: <%=text_field_tag 'minute',nil, :size => 4, :maxlength =>
2%>
<%= submit_tag 'Save' %>
<% end %> And a controller like this @fecha = DateTime.new(params[:year].to_i, params[:month].to_i, params[:day].to_i, params[:hour].to_i, params[:minute].to_i) @exam = Exam.new(DateTime.now, params[:place]) if @exam.save redirect_to exams_path else render :action => 'new' endThanks for your help.