I have included only the parts of the code required to demonstrate Filterrific. In a production app you would have to add a lot more code to handle permissions, strong params, etc.
Student model is the primary model which we will filter. It belongs to
Country class as shown below:
Student class is our primary class. This is where we include Filterrific.
# app/models/student.rb class Student < ActiveRecord::Base # db columns: # integer: id # string: first_name # string: last_name # text: email # integer: country_id # datetime: created_at belongs_to :country end
Country class represents the country a
Student belongs to, e.g.,
“Canada”, “United States”, and “Australia”.
Not all students belong to a country.
# app/models/country.rb class Country < ActiveRecord::Base # db columns: # integer: id # string: name has_many :students end