gregbell/active_admin — Issue #838: Filtering by 2 level relation
Author: miguelperez
Created: 2011-12-10 23:55:35+00:00
State: open

Imagine There is a Model A which has one B. And B has one C.

And you want to filter model A, based on attributes of the relation that B has with C.

class User < ActiveRecord::Base
has_one :school
delegate :school_name, :to => :school
end

class School < ActiveRecord::Base
#name string
end

class MathClass < ActiveRecord::Base
has_many :users
end

In the index page of MathClass I want to filter classes by school name. As you can see the math class is not related directly with schools.

This is just an example, But I want to accomplish that sort of filtering. Is it possible?