spec/relaxo/model/model_context.rb in relaxo-model-0.12.0 vs spec/relaxo/model/model_context.rb in relaxo-model-0.12.1
- old
+ new
@@ -26,12 +26,17 @@
property :id, UUID
property :invoice, BelongsTo[Invoice]
property :date, Attribute[Date]
+ def year
+ date.year
+ end
+
view :all, :type, index: :id
view :by_invoice, index: unique(:date, :id)
+ view :by_year, :type, 'by_year', index: unique(:year)
end
class User
include Relaxo::Model