app/models/addresses/address.rb in addresses-1.0.5 vs app/models/addresses/address.rb in addresses-1.0.6
- old
+ new
@@ -1,10 +1,11 @@
module Addresses
class Address < ActiveRecord::Base
belongs_to :zipcode
belongs_to :addressable, polymorphic: true
- validates :zipcode_id, :number, presence: true
+ validates :number, presence: true
+ validates :zipcode_id, presence: true, if: Proc.new{|a| a.zipcode.street.blank? }
delegate :street, :neighborhood, :city, to: :zipcode
accepts_nested_attributes_for :zipcode, allow_destroy: false
def to_s