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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:17:05+00:00 2026-06-14T03:17:05+00:00

I have 5 select’s in my html code. I send them to controller, but

  • 0

I have 5 select’s in my html code. I send them to controller, but for example some of them could be empty (default value is 0), so for example in some case i need to search only via params[:size] is some case only via params[:capacity] and in other params[:size] and params[:capacity] both as well… But how do to this? how to operate with find etc?
now i have something like this:

size = "*"+params[:akbsize]+"*"
    @accums = Accumulator.find(:all, :conditions => ["MATCH(description) AGAINST (? in boolean mode)", size])
    cap = "*"+params[:akbcapacity]+"*"
    @accums2 = Accumulator.find(:all, :conditions => ["MATCH(description) AGAINST (? in boolean mode)", cap])

But how to do as i described? Is it good to do here with metasearch gem?

  • 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-14T03:17:06+00:00Added an answer on June 14, 2026 at 3:17 am

    You could make method for it like so:

    class Accumulator
      def self.by_size(size)
        if size
          where("description LIKE ?", "%#{size}%")
        else
          scoped
        end
      end
    
      def self.by_capacity(capacity)
        if capacity
          where("description LIKE ?", "%#{capacity}%")
        else
          scoped
        end
      end
    end
    

    Then on your controller:

    @accums = Accumulator.by_size(params[:size]).by_capacity(params[:capacity])
    

    This would accomplish what u want. I think that the method all wouldn’t be necessary at all.

    =)

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

Sidebar

Related Questions

I have select html element with 'options' have both 'value' and 'id' values. What
I have select box with default value,i want to retrieve default value and changed
i have select <select id=parentId name=parentId><option value=1>ФАСАДНАЯ ШТУКАТУРКА&lt;BR /&gt;&lt;B&gt;&amp;#0171;STUC-O-FLEX&amp;#0187;&lt;/B&gt;</option> <option value=2>ФОНТАНЫ И САДОВАЯ МЕБЕЛЬ&lt;BR
I have select inputs dynamically added to form by $(selector).append(html) I'm using live('change',handler) to
I have <select multiple=multiple>..</select> select and I also have select{heigth: 30px;} in some stylesheet
Here is the code that I currently have: SELECT `A`.* FROM `A` LEFT JOIN
I have select <select multiple id=select2> <option value=1>1</option> <option value=2>2</option> <option value=3>3</option> </select> And
i have select input having id slt i want to pick innertext of value
If I have select with id=select_test, how to delete all options inside but select
Suppose I have select something: var $nodeAll = $('.sortable'); then I want select some

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.