This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ret = {} | |
DefaultPackage.all.each do |package| | |
ret.merge({package.name.to_sym => package.get_products_wearing}) | |
end | |
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gays" | |
module Configuration | |
def self.attributes | |
@attributes | |
end | |
def self.configure | |
base = ConfigBlock.new |