Sha256: e60cc2aa6a6488e66d84ac1e6a453f3e2acbe5e0ac348a4fa70a75ac02cf9e03

Contents?: true

Size: 461 Bytes

Versions: 4

Compression:

Stored size: 461 Bytes

Contents

class Usuario < ActiveRecord::Base

  validates_presence_of :nome, :email
  has_one :endereco, :class_name => "Endereco", :foreign_key => "usuario_id"
  accepts_nested_attributes_for :endereco, :allow_destroy => true

  def to_s
    nome
  end

  def ability
    @ability ||= Ability.new(self)
  end
  
  def self.current
    return Thread.current[:current_usuario]
  end
  
  def self.current=(usuario)
    Thread.current[:current_usuario] = usuario
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
templus_models-1.2.0 test/dummy/app/models/usuario.rb
templus_models-1.0.6 test/dummy/app/models/usuario.rb
templus_models-1.0.5 test/dummy/app/models/usuario.rb
templus_models-1.0.4 test/dummy/app/models/usuario.rb