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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org><h1>New cambios</h1> <%= error_messages_for :cambios %> <% form_for(@cambios) do |f| %> <p> <!--<b>User id origen</b><br />--> <%= f.text_field :user_id_origen %> </p> <p> <b>Fecha origen</b><br /> <%= f.date_select :fecha_origen %> </p> <p> <%= f.submit "Create" %> </p> <% end %> <%= link_to ''Back'', cambios_path %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <b>Fecha origen</b><br /> > <%= f.date_select :fecha_origen %>Shouldn''t this be f.date_select :start_date ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
(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 Foeh <elektroholun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > <b>Fecha origen</b><br /> > > <%= f.date_select :fecha_origen %> > > Shouldn''t this be f.date_select :start_date ?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---