Sha256: f1a9c1f67732d63ad91a0ec13ebea7d477006683b26f34bc4c643e4b34bdfaf0

Contents?: true

Size: 442 Bytes

Versions: 57

Compression:

Stored size: 442 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"
  validates_associated :cidade
  validates_presence_of :logradouro, :numero, :cep, :bairro, :cidade_id, :estado
  def to_s
    if logradouro.present?
      "#{logradouro}, #{numero} #{complemento}, #{bairro}, #{cidade.try(:cidade_estado)}"
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
templus_models-3.0.21 test/dummy/app/models/endereco.rb
templus_models-3.0.20 test/dummy/app/models/endereco.rb
templus_models-3.0.19 test/dummy/app/models/endereco.rb
templus_models-3.0.17 test/dummy/app/models/endereco.rb
templus_models-2.0.16 test/dummy/app/models/endereco.rb
templus_models-1.6.9 test/dummy/app/models/endereco.rb
templus_models-2.0.15 test/dummy/app/models/endereco.rb
templus_models-3.0.14 test/dummy/app/models/endereco.rb
templus_models-2.0.14 test/dummy/app/models/endereco.rb
templus_models-2.0.12 test/dummy/app/models/endereco.rb
templus_models-3.0.13 test/dummy/app/models/endereco.rb
templus_models-3.0.12 test/dummy/app/models/endereco.rb
templus_models-2.0.11 test/dummy/app/models/endereco.rb
templus_models-2.0.9 test/dummy/app/models/endereco.rb
templus_models-2.0.8 test/dummy/app/models/endereco.rb
templus_models-3.0.10 test/dummy/app/models/endereco.rb
templus_models-1.6.8 test/dummy/app/models/endereco.rb
templus_models-1.6.7 test/dummy/app/models/endereco.rb
templus_models-3.0.9 test/dummy/app/models/endereco.rb
templus_models-2.0.7 test/dummy/app/models/endereco.rb