Module | CouchPotato::Persistence::Properties::ClassMethods |
In: |
lib/couch_potato/persistence/properties.rb
|
Declare a property on a model class. Properties are not typed by default. You can store anything in a property that can be serialized into JSON. If you want a property to be of a custom class you have to define it using the :type option.
example:
class Book property :title property :year property :publisher, type: Publisher property :published_at, default: -> { Date.current } property :next_year, default: ->(book) { book.year + 1 } end