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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:21:49+00:00 2026-06-16T18:21:49+00:00

I now, that question could be non good for so, but need help: In

  • 0

I now, that question could be non good for so, but need help:
In my rails haml view i have such code:

%table.table.table-striped
  = form_tag :admin_other_price_upload do
    %tr    
      - @csv.first.length.times do |n|
        %th
          = n + 1
          %br/
          =select_tag "s"+(n+1).to_s, options_for_select([["Брэнд", "Brand"], ["Артикул","Article"], ["Наименование","Descr"], ["Цена","Price"], ["Количество","Quantity"], ["Дополнительно","Other"], ["Поле кроссов","Cross"]]), :prompt => 'Все', :id => "select-value"
*********************************

so as you can see i’m setting to all select’s name like s(n+1) and value one from list. But how can i get them both in controller method? I need it becouse i have dynamic table. I will explain it on example:

So i have table with select’s

name = s1 (value = Brand) | name = s2 (value = Price)

so i need in controller to get not only that s1 => Brand, but also get this 1 from s1
So if param look’s like
[
s1 => {Brand}
]
I need to get for my calculation s1 not value, but s1 as string (simple i need to find in params, which value has Brand and select it as a value)
So for Brand i need to select s1, and set as s1 value s1, how could i do it?

  • 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-16T18:21:50+00:00Added an answer on June 16, 2026 at 6:21 pm

    I may have understood you, but not sure.

    # let's say your params hash is like:
    params = { :action => 'show', :controller => 'articles', 
               :s1 => 'Article', :s2 => 'Brand', :s3 => 'Price', ... }
    
    brand_param = params.select{ |key, value| value == 'Brand' }
    # => { :s2 => 'Brand' }
    which_s_is_brand = brand_param.keys.first.to_s
    # => 's2'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: original question below, but I revise it now that I have some code
I have an odd question that I have always thought about, but could never
I'm re-casting a question I asked earlier now that I have an idea of
I asked this question in the restkit google group, but realize now that it
I have a follow up question to this one . Now that I have
I have this little question that's been on my mind for a while now.
Now that it's answered: Don't bother reading this question, it's a bit lengthy and
Please note that this question is from 2008 and now is of only historic
The Question: When you UnicastRemoteObject.exportObject(instance) . Does that instance now become publicly available to
Yesterday I asked another question to calculate time. Now I realized, that it makes

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.