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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:49:40+00:00 2026-06-02T22:49:40+00:00

So basically I have two types of status’ and I’d like to display both

  • 0

So basically I have two types of status’ and I’d like to display both properties with status_id “2” and status_id “5”, properties never have two status’ so I know I don’t want to use an & here, I’d like to be able to have and or statement but I’m not sure how to go about doing that. This is what I have to show just status_id “2” and it works just fine.

@properties = Property.order("updated_at DESC").paginate(:per_page => 20, :page => params[:page], :conditions => { :status_id => '2' })

in my model I also have scopes that look like the following, not sure if I could do it that way…

scope :for_sale, joins(:status).where(:statuses => { :current => 'For Sale'})
scope :market_listings, joins(:status).where(:statuses => { :current => 'Market Listing'})

any help would be appreciated.

  • 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-02T22:49:42+00:00Added an answer on June 2, 2026 at 10:49 pm

    Instead of using :conditions in the paginate call, it would IMO be clearer and easier to use where like this:

    @properties = Property.where('status_id = 2 or status_id = 5').order("updated_at DESC").paginate(:per_page => 20, :page => params[:page])
    

    This is also possible:

    @properties = Property.order("updated_at DESC").paginate(:per_page => 20, :page => params[:page], :conditions => 'status_id = 2 or status_id = 5')
    

    Or even simpler:

    @properties = Property.order("updated_at DESC").paginate(:per_page => 20, :page => params[:page], :conditions => { :status_id => [2,5] })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two action methods that are conflicting. Basically, I want to be able
I've been struggling with this for a while. Basically, I want to have two
I'm new to these types of MySQL Queries. Basically, I have two tables in
I have a tree-like object structure that consists of two types of objects: object
I have two lists. The types of both lists inherit from the same base
I have two ways of doing a similar thing and would like to know:
If I were to select a row from a table I basically have two
Basically I have two 2D points and there is a line between them. A
I have found many people with simliar issues but no soultions...basically I have two
I have basically two questions. How do I locate the default Rprofile which is

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.