Module: Pipeline::SymbolAttribute
- Defined in:
- lib/pipeline/core_ext/symbol_attribute.rb
Overview
Extends ActiveRecord::Base to save and retrieve symbol attributes as strings.
Example:
class Card < ActiveRecord::Base
symbol_attrs :rank, :suit
end
card = Card.new(:rank => 'jack', :suit => 'hearts')
card.rank # => :jack
card.suit # => :hearts
It also allow symbol attributes to be used on ActiveRecord #find conditions:
Card.find(:all, :conditions => ['suit = ?', :clubs])
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
17 18 19 |
# File 'lib/pipeline/core_ext/symbol_attribute.rb', line 17 def self.included(base) base.extend(ClassMethods) end |