Sha256: 92a9caf3ef01dc1a953c87c091e4acb0e15e3cecfee1964cb37b536a4698fe65

Contents?: true

Size: 815 Bytes

Versions: 1

Compression:

Stored size: 815 Bytes

Contents

class User

  include Mongoid::Document

  field :first_name, :type => String
  field :last_name, :type => String
  field :age, :type => Integer
  field :active, :type => Boolean
  field :created_at, :type => DateTime
  field :updated_at, :type => DateTime

  embeds_one :profile, :class_name => "Profile", :inverse_of => :user
  embeds_many :tasks, :class_name => "Task", :inverse_of => :user

  validates :first_name, :last_name, :presence => true

  acts_as_api

  include SharedEngine::UserTemplate

  def over_thirty?
    age > 30
  end

  def under_thirty?
    age < 30
  end

  def return_nil
    nil
  end

  def full_name
    '' << first_name.to_s << ' ' << last_name.to_s
  end

  def say_something
    "something"
  end

  def sub_hash
    {
      :foo => "bar",
      :hello => "world"
    }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_api-0.4.1 spec/mongoid_dummy/app/models/user.rb