Class: Vindi::Model
- Inherits:
-
Object
- Object
- Vindi::Model
- Includes:
- Her::Model
- Defined in:
- lib/vindi/models/model.rb
Overview
Base model to vindi resources.
Direct Known Subclasses
Address, Bill, BillItem, Charge, Customer, Discount, Issue, Notitication, PaymentMethod, PaymentProfile, Period, Plan, PlanItem, PricingSchema, Product, ProductItem, Subscription, Transactiton
Class Method Summary collapse
Instance Method Summary collapse
-
#archive! ⇒ Object
Archive a record.
- #valid? ⇒ Boolean
Class Method Details
.first(limit = 1) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/vindi/models/model.rb', line 56 def first(limit = 1) records = order_by(:created_at, :asc).per_page(limit) return records[0] if limit == 1 records end |
.last(limit = 1) ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/vindi/models/model.rb', line 70 def last(limit = 1) records = order_by(:created_at, :desc).per_page(limit) return records[0] if limit == 1 records end |
Instance Method Details
#archive! ⇒ Object
Archive a record.
40 41 42 |
# File 'lib/vindi/models/model.rb', line 40 def archive! destroy end |
#valid? ⇒ Boolean
45 46 47 |
# File 'lib/vindi/models/model.rb', line 45 def valid? super && response_errors.empty? end |