Topic: habtm filter by category
class Exercise < ActiveRecord::Base
class Subcategory < ActiveRecord::Base
class Category < ActiveRecord::Base
@category = @params['category']
@subcategory = @params['subcategory']
@exercises = Exercise.find(:all, :order => sort_clause)
@categories = Category.find_all
@subcategories = Subcategory.find_all
what :conditions clause would i, or should i put to return only the exercises that are associated to the id @params['category']
i have my exercises_categories table keeping track of all the categories assigned to each exercise, but i need to be able to find and display all exercises associated to any given category.
i 'think' it's means doing something like @exercises = Exercise.find(:all, :order => sort_clause, :conditions => ???????? )
is there a better way?
Last edited by alanpieroway (2006-11-17 20:26:23)