Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5996859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:10:57+00:00 2026-05-23T00:10:57+00:00

I am trying to set a datetime field using the ruby forum helpers. <%=

  • 0

I am trying to set a datetime field using the ruby forum helpers.

<%= form_for @event  do |f| %>
  <%= render 'shared/error_messages', :object => f.object %>
  <strong>Title</strong>
  <div class="field">
    <%= f.text_field :title  %>
  </div>
  <strong>Description</strong>
  <div class="field">
    <%= f.text_area :description, :class => "comment" %>
  </div>
  <strong>Location</strong>
  <div class="field">
    <%= f.text_field :location  %>
  </div>
  <strong>Time</strong>
  <div class="field">
    <%= select_datetime Date.today, :prefix => :start_date %>
  </div>
  <div class="actions">
    <%= f.submit "Add Event" %>
  </div>
<% end %>

In the controller I am doing this:
class EventsController < ApplicationController
def index
@event = Event.new
end

  def create
    @event = current_user.events.build(params[:event])
    if @event.save
      redirect_to root_path, :flash => { :success => "#{@event.inspect}!" }
    else
      @feed_items = []
      render 'pages/home'
    end
  end
end

However the date time never sets…what am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:10:58+00:00Added an answer on May 23, 2026 at 12:10 am

    You need to process what you’re getting in your controller, like:

    def create
        @event = current_user.events.build(params[:event])
        datetime=DateTime.civil(params[:start_date][:year].to_i, params[:start_date][:month].to_i, params[:start_date][:day].to_i,
                                params[:start_date][:hours].to_i,params[:start_date][:minutes].to_i, params[:start_date][:seconds].to_i)
        @event.datetime = datetime
        if @event.save
          redirect_to root_path, :flash => { :success => "#{@event.inspect}!" }
        else
          @feed_items = []
          render 'pages/home'
        end
      end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to convert an access datetime field to a mysdl format, using
I am trying to update a DateTime object into a datetime field of a
I am trying to set my columns default date time to system datetime. It
Trying to set up caching on our datasets - we're using clr stored procedures
I am trying to set the value of a field via a hidden form
I am developing a project that has a DateTime field. In it I'm using
Have a publish_on datetime field. Just trying to get to the begining_of_week from the
I'm trying to create an Editor Template for a DateTime field and it does
I am trying to set a timestamp in my database using java, however in
Im trying set the single table inheritance model type in a form. So i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.