Sha256: a47190a1abf5e43e9440c22348f5af299647c13508b38aa6bae100ff3dfedae4

Contents?: true

Size: 330 Bytes

Versions: 10

Compression:

Stored size: 330 Bytes

Contents

class Endereco < ActiveRecord::Base
  belongs_to :cidade
  delegate :estado, to: :cidade, allow_nil: true
  belongs_to :usuario, :class_name => "Usuario", :foreign_key => "usuario_id"
  def to_s
    if logradouro.present?
      "#{logradouro}, #{numero} #{complemento}, #{bairro}, #{cidade.try(:cidade_estado)}"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
templus_models-1.2.6 test/dummy/app/models/endereco.rb
templus_models-1.2.5 test/dummy/app/models/endereco.rb
templus_models-1.2.4 test/dummy/app/models/endereco.rb
templus_models-1.2.3 test/dummy/app/models/endereco.rb
templus_models-1.2.2 test/dummy/app/models/endereco.rb
templus_models-1.2.1 test/dummy/app/models/endereco.rb
templus_models-1.2.0 test/dummy/app/models/endereco.rb
templus_models-1.0.6 test/dummy/app/models/endereco.rb
templus_models-1.0.5 test/dummy/app/models/endereco.rb
templus_models-1.0.4 test/dummy/app/models/endereco.rb