Given
Project
, Task
, and Activity
, I've managed to set up a has_one :through
relationship filter with the following:class Project < ActiveRecord::Base
has_many :tasks
end
class Task < ActiveRecord::Base
belongs_to :project
has_many :activities, :dependent => :destroy
end
class Activity < ActiveRecord::Base
has_many :tasks
has_one :project, through: :task
end
ActiveAdmin.register User do
filter :task_project_id, as: :select, collection: Project.all, label: 'Project'
end
No comments:
Post a Comment