Sha256: c78239ea283f2c046bf0d7390dcfbf66e2e73b45cc5ce9b61170c42c9d340ab5

Contents?: true

Size: 407 Bytes

Versions: 4

Compression:

Stored size: 407 Bytes

Contents

class User < Person
  has_many :addresses, :foreign_key => 'person_id'
  accepts_nested_attributes_for :addresses
  attr_accessible :addresses_attributes

  has_and_belongs_to_many :categories,
    :readonly => true,
    :join_table => 'categories_elements',
    :foreign_key => 'element_id',
    :association_foreign_key => 'category_id'

  def age
    ((Date.today - self.birthday) / 365).floor
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
forgeos_core-1.9.5.rc2 app/models/user.rb
forgeos_core-1.9.5.rc1 app/models/user.rb
forgeos_core-1.9.4 app/models/user.rb
forgeos_core-1.9.3 app/models/user.rb