Sha256: 461791a67273823c37984e8db2cb6b4587dcd35d99b86a4f1f20ce5154439746

Contents?: true

Size: 600 Bytes

Versions: 2

Compression:

Stored size: 600 Bytes

Contents

require 'subj_models/concerns/comprising_external_id'

module SubjModels

  module UserDeliveryAddress

    def self.included(including_class)

      including_class.class_eval do

        include SubjModels::ComprisingExternalId

        belongs_to :user
        belongs_to :city

        has_many :orders

        validates :street_name, :house_number, :city, presence: true, unless: :skip_validations

        attr_accessor :skip_validations

        scope :user_id, -> (user_id) { parent_id_scope("user", user_id) }

      end

      def to_s
        id.to_s # TODO
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
subj_models-0.4.1 lib/subj_models/user_delivery_address.rb
subj_models-0.4 lib/subj_models/user_delivery_address.rb