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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:14:20+00:00 2026-05-27T07:14:20+00:00

From this documentation I see that I can use the select method like this:

  • 0

From this documentation I see that I can use the select method like this:

select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true })

and it yields:

<select name="post[person_id]">
  <option value=""></option>
  <option value="1" selected="selected">David</option>
  <option value="2">Sam</option>
  <option value="3">Tobias</option>
</select>

What would my select method look like if I have an array like this:

[["Add Post", new_post_path],["Add Document", new_document_path],["Add Coupon", new_coupon_path]]

And I want html like this:

<select name="post[person_id]">
  <option value="new_post_path" selected="selected">Add Post</option>
  <option value="new_document_path">Add Document</option>
  <option value="new_coupon_path">Add Coupon</option>
</select>
  • 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-27T07:14:21+00:00Added an answer on May 27, 2026 at 7:14 am

    In your controller:

    @paths = [ ["Add Post", new_post_url], ["Add Document", new_document_url], ... ]
    

    In your view

    select("post", "person_id", @paths, { :include_blank => true })
    

    This should put the actual URL in the value field. If you want the strings as you noted above, but the paths in quotes, e.g. ["Add Post", "new_post_path"]

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

Sidebar

Related Questions

I couldn't find anything about this in MySQL documentation. SELECT accesion_id, definition FROM accesion_table
From the isKindOfClass: method documentation in NSObject: Be careful when using this method on
So I'm working on this class that's supposed to request help documentation from a
I read in the documentation that I can use the statement echo on; to
From this page: http://www.doctrine-project.org/documentation/manual/1_2/en/working-with-models#dealing-with-relations:creating-related-records You can see that it says $obj['property']; is the recommended
I ran the code to create the generically related objects from this demo: http://www.djangoproject.com/documentation/models/generic_relations/
Sorry if this is a dead simple question but I'm confused from the documentation
From this post . One obvious problem is scalability/performance. What are the other problems
From this code I can call bmwCars.CopyToDataTable() as I expected. var bmwCars = from
Here's the query that is being executed on SQL Server 2008: SELECT "dbo"."tblMainData"."recID" FROM

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.