I''m running into an odd situation where datetime_select is making the hours into minutes and putting nothing in for hours. My database table is mysql which looks like: create_table :my_sessions do |t| t.integer :user_id t.string :ssession_id t.date :start_date t.time :start_time t.time :end_time t.string :location t.string :title t.string :source t.boolean :msg_sent t.timestamps end The View is standard scaffold: <h1>Editing my_session</h1> <% form_for (@my_session) do |f| %> <p> <%= f.label :ssession_id %><br /> <%= f.text_field :ssession_id %> </p> <p> <%= f.label :start_date %><br /> <%= f.date_select :start_date %> </p> <p> <%= f.label :start_time %><br /> <%= f.datetime_select :start_time %> </p> <p> <%= f.label :end_time %><br /> <%= f.datetime_select :end_time %> </p> <p> <%= f.label :location %><br /> <%= f.text_field :location %> </p> <p> <%= f.label :title %><br /> <%= f.text_field :title %> </p> <p> <%= f.submit "Update" %> </p> <% end %> <%= link_to ''Show'', @my_session %> | <%= link_to ''Back'', my_sessions_path %> My controller is: def update user = User.find(session[:user_id]) @my_session = MySession.find(params[:id], :conditions => ["my_sessions.user_id = ?", user.id]) respond_to do |format| if @my_session.update_attributes(params[:my_session]) flash[:notice] = ''MySession was successfully updated.'' format.html { redirect_to(@my_session) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @my_session.errors, :status => :unprocessable_entity } end end end The model is empty. Again, if I view my edit page and the time that is returned from the database is: January 1, 2007, 13:45 I change it on the form to be: January 1, 2007, 12:45 What gets stored is: January 1, 2007, 1:12 When creating a new record the day gets set as the hour, the hour the minute and the minute the seconds. Its really odd. Any help would be great. Thanks Matt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''ve done some more playing around with this and it looks like if I :include_seconds true the values update as expected. However, without this it always shifts the values one to the right. My guess is that in the code for the actionview helper it doesn''t append :00 to the end of the time. Looking at the html generated code there is a new my_session[start_time(6i)] name thats created. If I don''t have the include_seconds there is no hidden value for this on the page, which is what I''m guessing is the cause of the problem. I''m new to rails, who/how would I go about posting this as a possible bug. Is there any other validation I should go about before posting it? -- 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 -~----------~----~----~----~------~----~------~--~---
On Sep 16, 4:45 am, Matt Topper <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''ve done some more playing around with this and it looks like if I > :include_seconds true the values update as expected. However, without > this it always shifts the values one to the right. My guess is that in > the code for the actionview helper it doesn''t append :00 to the end of > the time. > > Looking at the html generated code there is a new > my_session[start_time(6i)] name thats created. If I don''t have the > include_seconds there is no hidden value for this on the page, which is > what I''m guessing is the cause of the problem. > > I''m new to rails, who/how would I go about posting this as a possible > bug. Is there any other validation I should go about before posting it? > > -- > Posted viahttp://www.ruby-forum.com/.What Rails version are you using? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---