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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:52:56+00:00 2026-05-22T12:52:56+00:00

Ok, I’m slowly getting a grasp on this, but I need some more help.

  • 0

Ok, I’m slowly getting a grasp on this, but I need some more help.

I’m using a time_select in my view, therefore I’m dealing with a multiparameter assignment. Check.

<%= pt.time_select :time, :twelve_hour => true, :minute_step => 5 %>

BUT I’m doing the naughty thing and using it with an attribute that isn’t in the database:

attr_accessor time

Therefore since it can’t look at the db, it can’t piece together what the multiparameter assignment is supposed to be and therefore I get the following error:

1 error(s) on assignment of multiparameter attributes

Thus I am using information I found here:

  composed_of :time,
            :class_name => 'DateTime',
            :mapping => [%w(DateTime to_s)],
            :constructor => Proc.new{ |item| item },
            :converter => Proc.new{ |item| item }

Other helpful links: rubyonrails.org | apidock.com

This remove the error, but now the issue is that the plugin I’m using doesn’t function properly, I think. I am using http://code.google.com/p/rails-twelve-hour-time-plugin/. The goal being, I’m trying to get the time select to have 3 drop downs: hh:mm am/pm.

So the question is: how do I need to adjust my composed_of method in order for it to be properly converted by the plugin? OR is there a better method to this madness?

I’m not sure what mappers / constructors / converters I need. Right now the object keeps the hour and minute, except the hour isn’t converted to 24 hour (which the plugin is supposed to take care of, I thought).

  • 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-22T12:52:57+00:00Added an answer on May 22, 2026 at 12:52 pm

    The issue was that I didn’t follow the article properly. I should have been using the Time model.

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

    Looks like this is a common problem. For more information about it check out this link. The suggestion given there is to do:

    class Whatever < ActiveRecord::Base
      ...
    
      attr_accessor :arrival_time
      columns_hash["arrival_time"] = ActiveRecord::ConnectionAdapters::Column.new("arrival_time", nil, "time")
    end
    

    I’m still working out bugs, but I’ll update this when I get something working.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have thousands of HTML files to process using Groovy/Java and I need to
I need to clean up various Word 'smart' characters in user input, including but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.