Module: PlainRecord::Default

Included in:
Model
Defined in:
lib/plain_record/default.rb

Overview

Extention to set default value for field.

class Post
  include PlainRecord::Resource

  entry_in '*/*/post.md'

  virtual :category, default('uncategorized')
  
end

post = Post.new
post.category       #=> "uncategorized"
post.category = "a"
post.category       #=> "a"

Instance Attribute Summary collapse

Instance Attribute Details

#default_valuesObject

Returns the value of attribute default_values.



38
39
40
# File 'lib/plain_record/default.rb', line 38

def default_values
  @default_values
end