Skip to content

Instantly share code, notes, and snippets.

@carlossanchezp
Created June 28, 2013 16:18
Show Gist options
  • Select an option

  • Save carlossanchezp/5885946 to your computer and use it in GitHub Desktop.

Select an option

Save carlossanchezp/5885946 to your computer and use it in GitHub Desktop.
ejemplo active admin through
class Brand < ActiveRecord::Base
has_many :car_models
end
class CarModel < ActiveRecord::Base
has_many :production_years
belongs_to :brand
end
class ProductionYear < ActiveRecord::Base
belongs_to :car_model
has_one :brand, :through => :car_model
end
ActiveAdmin.register ProductionYear do
filter :brand, :as => :check_boxes, :collection => proc { Brand.all }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment