Topic: classified ads in selected city and category, habtm...
I have classified ads (cads) related with cities and categories:
class Cad < ActiveRecord::Base
class Category < ActiveRecord::Base
class City < ActiveRecord::Base
First, i choose city (assume it's X) and receive classified ads associated with X and categories of these ads:
@city = City.find(params[:id])
@cads = @city.cads
@categories_inside_city = @city.find_categories_for_cads_in_selected_city
After that i choose category (assume it's Y) and want to receive only
these classified ads which cities include X and categories include Y.
I can't figure out how to achieve this?