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 8078633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:51:24+00:00 2026-06-05T15:51:24+00:00

So normally I use the date_select helper in my Rails applications in my Models’

  • 0

So normally I use the date_select helper in my Rails applications in my Models’ forms, but in the most recent application I was building, I needed to specify individual css id’s for each drop down (month, day, year), and that isn’t possible with date_select. So instead, I’ve been using select_month, select_day, and select_year helpers. Here’s the problem: how do I get them to all describe one datetime record in my database?

(I’ve looked at this question by the way, but it looks pretty useless to me. Plus, I don’t want to do some hacky jQuery stuff handling this.)

Here’s what I have so far:

#default_time_for is just a helper method that returns the default time for the specified "period" of time (month,day,etc.)

<%= select_month(default_time_for(:month)) %>
<%= select_day(default_time_for(:day)) %> 
<%= select_year(default_time_for(:year), {:start_year => Time.now.year-18, :end_year => 1930}) %>
  • 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-06-05T15:51:27+00:00Added an answer on June 5, 2026 at 3:51 pm

    I’d combine them on the server side:

    require 'date'
    
    def update
      date = Date.parse(params[:year] + params[:month] + params[:day])
    
      # Add to object and save
    end
    

    You can still do mass-assignment, assuming that date is the field you want to assign to, you could do the following:

    def update
      date = Date.parse(params[:year] + params[:month] + params[:day])
      params = params.merge( { :user => { :date => date }})
    
      @user = User.find(params[:id])
      if @user.update_attributes(params)
        # save was good
      else
        # save was bad
      end
    end
    

    Also make sure you’re familiar and mitigated against the security issued cased by Mass Assignment if you’re going to use the above code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I normally use gVim for editing, but I sometimes use vim when remotely connecting
I normally use only the facebook javascript api, but the login started to give
I normally use the python shell to test small things, with no needed to
I normally use the following code in SQL Server: IF EXISTS (SELECT * FROM
I normally use a dirty method to get my Facebook Graph API token key
keep in mind I normally use pure as3 and FlashDevelop :) I am really
I have this code that where I would normally use one line: if (tableView
I have identified the query constructs my users normally use. Would it make sense
I am encountering a very strange error with my project. I normally use the
I want to detect when my touchpad is clicked! I normally use a usb

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.