Skip to content

Instantly share code, notes, and snippets.

@jtroxel
Created October 31, 2012 02:52
Show Gist options
  • Save jtroxel/3984535 to your computer and use it in GitHub Desktop.
Save jtroxel/3984535 to your computer and use it in GitHub Desktop.
Client of reusable Rails association
include CategoryGroup # Module to help a AR model associate to a category scoped by a "group"
has_many :categorizations, :as => :categorizable
has_many :categories, :through => :categorizations
category_group_association 'product', Category::PRODUCTS # create has_many for categorizations and categories, called product_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment