dazuma
April 19, 2008, 1:13am
1
Hi!I think it’s easy but for some reason what I want to do is not
working. When I call to the new method I do that before render the
new.html.erb page:
@cambio = Cambio.new
@cambio.user_id_origen = current_user.id
@cambio.start_date = current_user.date
Debuggin with Aptana I’ve seen that @cambio.start_date gets the correct
value, but when the html page renders it can’t fill the form field with
that value. Anybody knows how can I do that?
Thanks in advance.
dazuma
April 19, 2008, 1:51am
2
What does your new.html.erb look like?
It depends of the type of field you are using when trying to display
the value.
Serge
On Apr 18, 8:13 pm, “Daniel A.” [email protected]
dazuma
April 19, 2008, 2:14am
3
sergecpelletier wrote:
What does your new.html.erb look like?
It depends of the type of field you are using when trying to display
the value.
Serge
On Apr 18, 8:13 pm, “Daniel A.” [email protected]
New cambios
<%= error_messages_for :cambios %>
<% form_for(@cambios ) do |f| %>
<%= f.text_field :user_id_origen %>
Fecha origen
<%= f.date_select :fecha_origen %>
<%= f.submit "Create" %>
<% end %>
<%= link_to ‘Back’, cambios_path %>
dazuma
April 20, 2008, 3:26pm
4
<b>Fecha origen</b><br />
<%= f.date_select :fecha_origen %>
Shouldn’t this be f.date_select :start_date ?
dazuma
April 21, 2008, 4:14pm
5
(Yes, start_date unless it’s been translated for our English-speaking
group).
Also, it appears that you are using @cambio (singular) in the
controller and @cambios (plural) in the form_for of the view.
On Apr 20, 9:26 am, Jan-Christian F. [email protected]