Sha256: a3146e038db95de1aeb2a1a26f84b3823a4b011ae76df6f591a5d3ae71a026de

Contents?: true

Size: 441 Bytes

Versions: 2

Compression:

Stored size: 441 Bytes

Contents

module Addresses
    class Address < ActiveRecord::Base
        attr_accessor :state_id
        
        belongs_to :city
        belongs_to :neighborhood
        belongs_to :addressable, polymorphic: true

        validates :zipcode, :number, :city_id, :state_id, presence: true

        def to_s
            "#{self.street}, #{self.number}, #{self.neighborhood}. #{self.city.name} - #{self.city.state.abbreviation}"
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
addresses-0.0.3 app/models/addresses/address.rb
addresses-0.0.2 app/models/addresses/address.rb