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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:50:11+00:00 2026-05-20T04:50:11+00:00

I have the following code in my form. <%= f.datetime_select(:date_time, :prompt => {:day =>

  • 0

I have the following code in my form.

<%= f.datetime_select(:date_time, :prompt => {:day => 'Day', :month => 'Month', :year => 'Year'}, :start_year => Date.today.year, :end_year => Date.today.year + 2, :minute_step => 15, :include_blank => false) %> if either one is blank.

When one of the fields is left blank, I get:

1 error(s) on assignment of multiparameter attributes

The params that are being passed are:

{"utf8"=>"✓",
 "authenticity_token"=>"kQpfsj5RxnDtxkvBdwPEFnX1fY6euKnMQeDRAkvJvIE=",
 "event"=>{"description"=>"",
 "venue"=>"",
 "street"=>"",
 "city"=>"",
 "country_id"=>"",
 "date_time(1i)"=>"",
 "date_time(2i)"=>"",
 "date_time(3i)"=>"",
 "date_time(4i)"=>"00",
 "date_time(5i)"=>"00",
 "ticket_url"=>""},
 "x"=>"94",
 "y"=>"12"}

Anyone know why this is occurring?

There seems to be a “dirty” fix for this at this link, but perhaps there is a better solution in Rails 3?

  • 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-20T04:50:11+00:00Added an answer on May 20, 2026 at 4:50 am

    Christian. This is a bug in Rails that checks the database to infer the type needed for the multiparameter attributes. My guess is that your “date_time” attribute is not associated with a time column in your database.

    I recently tackled this problem where I wanted a non-database attribute to accepted multiparameter attributes, this was the best solution I could come up with:

    I found myself wanting to set an attr_accessor to handle passing a date to my model in a form_for tag with the f.datetime_select helper. So this is what I had:

    Model:

    attr_accessor :my_time
    

    View:

    <%= f.datetime_select :my_time %>
    

    Unfortunately when I submit my form I get this:

    1 error(s) on assignment of multiparameter attributes
    

    Well it turns out that this is actually a Rails bug a ticket for which has been submitted. In the meantime how do we make this work? The only solution I could find that was remotely attractive was to make use of composed_of as a replacement for attr_accessor. so…

    Model:

      composed_of :my_time,
                  :class_name => 'Time',
                  :mapping => %w(Time to_s),
                  :constructor => Proc.new{ |item| item },
                  :converter => Proc.new{ |item| item }
    

    I know almost nothing about the composed_of method so you should probably do your own reading on it, but what I do know is that it creates both a reader and writer for the given instance variable, and more importantly, the setter accepts multiparameter attributes. How I chose the options:

    class_name: the name of our expected class. In this case, Time
    mapping: the first argument is the class and the second argument seems to work with any method that an instance of the class responds to. I chose to_s
    constructor: Not really sure how this is supposed to work. Seems to be called when @my_time is nil.
    converter: Not really sure how this is supposed to work. Seems to be called when from my_time=, but doesn’t seem to be applied with mass assignment.
    One problem I ran into with this solution was that times were getting set in UTC instead of the environment’s time zone. So unfortunately we cannot use my_time directly, but instead need to convert it to the proper time zone:

    Time.zone.parse(my_time.to_s(:number))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In every form we derive from FormBaseControl , we have the following code. I'm
I have in my Form constructor, after the InitializeComponent the following code: using (WebClient
I have code with the following form: <?php function doSomething{ //Do stuff with MySQL
I have following code that is accepting a form submission [ActionName(TestingTemp), AcceptVerbs(HttpVerbs.Post)] public ActionResult
Hi I have the following code in a form . When the user clicks
currently I have following code: home.php <form name='myformname' id='myformid'> <input type='text' name='mytext1' value='abc'> <input
I have the following code for a button click on a form: private void
I have the following code in my project, deleteselector is a form that has
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section

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.