app/models/addresses/address.rb in addresses-1.0.6 vs app/models/addresses/address.rb in addresses-1.0.7

- old
+ new

@@ -2,10 +2,10 @@ class Address < ActiveRecord::Base belongs_to :zipcode belongs_to :addressable, polymorphic: true validates :number, presence: true - validates :zipcode_id, presence: true, if: Proc.new{|a| a.zipcode.street.blank? } + validates :zipcode_id, presence: true, if: Proc.new{|a| a.try(:zipcode).try(:street).blank? } delegate :street, :neighborhood, :city, to: :zipcode accepts_nested_attributes_for :zipcode, allow_destroy: false def to_s