Sha256: 83ab957e81c97d3243f672fe5093071ca77486c9d6092c21ac7e2874e315f2bb

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

# 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apimaster-0.0.4 lib/apimaster/generators/templates/app/models/example.rb.erb