Sha256: 9b55e1c1fd5979715d87a19844ca1cf59f21245854ddcc87c666825f2cb9c88b

Contents?: true

Size: 597 Bytes

Versions: 49

Compression:

Stored size: 597 Bytes

Contents

require 'subj_models/concerns/comprising_external_id'

module SubjModels

  module UserDeliveryAddressModule

    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) { where(user_id: user_id) }

      end

      def to_s
        id.to_s # TODO
      end

    end

  end

end

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
subj_sub_models-0.0.3.29 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.28 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.27 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.26 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.25 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.24 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.23 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.22 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.21 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.20 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.19 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.18 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.17 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.16 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.15 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.14 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.13 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.12 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.11 lib/subj_models/user_delivery_address.rb
subj_sub_models-0.0.3.10 lib/subj_models/user_delivery_address.rb