Sha256: 3cb383dc1d2e674644d0ae48d89ad62492ac03770889759f15c975b5844570c7
Contents?: true
Size: 894 Bytes
Versions: 7
Compression:
Stored size: 894 Bytes
Contents
class Account include Mongoid::Document field :_id, type: String, default: ->{ name.try(:parameterize) } field :number, type: String field :balance, type: String field :nickname, type: String field :name, type: String field :balanced, type: Boolean, default: ->{ balance? ? true : false } field :overridden, type: String embeds_many :memberships belongs_to :creator, class_name: "User", foreign_key: :creator_id belongs_to :person has_many :alerts has_and_belongs_to_many :agents has_one :comment, validate: false attr_accessible :nickname, as: [ :default, :admin ] attr_accessible :name, as: [ :default, :admin ] attr_accessible :balance, as: :default validates_presence_of :name validates_presence_of :nickname, on: :upsert validates_length_of :name, maximum: 10, on: :create def overridden self[:overridden] = "not recommended" end end
Version data entries
7 entries across 7 versions & 2 rubygems