Skip to content

Instantly share code, notes, and snippets.

ret = {}
DefaultPackage.all.each do |package|
ret.merge({package.name.to_sym => package.get_products_wearing})
end
ret
# With macro
has_many :comments, :foreign_key => 'commentable_id', :conditions => "commentable_type = 'User'", :dependent => :destroy
# Without macro
def comments
Comment.all(:conditions => {:commentable_id => self.id, :commentable_type => 'User'})
end
before_destroy :remove_associated_comments
require "gays"
module Configuration
def self.attributes
@attributes
end
def self.configure
base = ConfigBlock.new