# encoding: utf-8 # # Copyright (C) 2011-2012 AdMaster, Inc. module <%= module_name %> class <%= camelize name %> < Apimaster::Mapper include Mongoid::Document field :title, type: String field :content, type: String attr_options :title, accessor: [:get, :list], required: [:post], optional: [:patch] attr_options :content, accessor: [:get], required: [:post], optional: [:patch] validates :title, length: { minimum: 2, maximum: 30 } class << self def get id find id or raise MissingError.new(<%= name %>, :id) end end end end