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.
Instead of using
:conditionsin thepaginatecall, it would IMO be clearer and easier to usewherelike this:This is also possible:
Or even simpler: