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

  • Home
  • SEARCH
  • 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 7518573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:46:07+00:00 2026-05-30T01:46:07+00:00

I have the following in a partial in a Rails 3.2 app using formtastic

  • 0

I have the following in a partial in a Rails 3.2 app using formtastic gem

<%= f.semantic_fields_for :bucket do |bucket| %>
                       <%= bucket.inputs do %>
                               <%= bucket.input :bucket_name, :collection => @buckets,
                               :include_blank => false %>
                               <%= bucket.input :sub_directory, :collection =>
@buckets.first.paths,
                               :include_blank => false %>
                       <% end %>
               <% end %>

right now in my controller I can get :bucket_name and the value is ==
to an integer, In my case I only have one item in my collection but it is giving me a value of 2. My guess is this is the ID value of the object.

it’s important that I get the actual :name string value of the object
that is selected in the collection. I am not sure how to do this. so
let’s say the item I select has a label of “my label” and it’s the 3rd
item in the collection. how would I grab the value “my label”.

  • 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-30T01:46:07+00:00Added an answer on May 30, 2026 at 1:46 am

    By default, select inputs will use the id attribute of the model as the value attribute of the <option> tags, and it ties various methods on the object for the contents of the option tag such as to_label, name, and to_s.

    You can change both with the :member_value and :member_label options respectively (these were called :value_method and :label_method in older versions.

    The details of each option are in the documentation for the select input:

    http://rdoc.info/github/justinfrench/formtastic/Formtastic/Inputs/SelectInput

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

Sidebar

Related Questions

I have the following code in a partial view (using Spark): <span id=selectCount>0</span> video(s)
I have a partial that renders a select box using the following method: <%=
In my Rails app, I have the following method: def navigation_menu(items) # raise items.class.to_s
I have a large Ruby on Rails form that has the following partial view
I have the following code: public partial class queryTerm : System.Web.UI.UserControl { private static
in a partial view I have the following: <%Html.RenderAction(MVC.User.GetComments(Model.UserGroupName)); %> can I render a
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
I have an Ajax form in my Rails app that contains the Recaptcha markup
I've been using the gmaps4rails gem for a while in rails 3.1 and it
I have the following partial. It can be called from three different times in

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.