Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/extensions/active_record/nested_attributes.rb,
lib/extensions/active_record/statuses.rb
Direct Known Subclasses
BillingActivity, ContactInfo, CreditCard, Invoice, InvoiceLineItem, Payment, Plan, Subscription, Transaction
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.has_statuses(*status_names) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/extensions/active_record/statuses.rb', line 2 def self.has_statuses(*status_names) validates :status, :presence => true, :inclusion => { :in => status_names } # Status Finders status_names.each do |status_name| scope "all_#{status_name}", where(:status => status_name) end # Status Accessors status_names.each do |status_name| define_method "#{status_name}?" do status == status_name end end end |