Sha256: b267ec01c27659768c083dec67b947db4fe9763947a8ad3b0e21b655c0f701aa
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
module ShoppingCart class Address < ApplicationRecord belongs_to :order, optional: true belongs_to :user, class_name: ShoppingCart.user_class.to_s, optional: true validates :first_name, :last_name, :address, :city, :zip, :country, :phone, presence: true validates :first_name, :last_name, :address, :city, :country, length: { maximum: 50 } validates :first_name, :last_name, :city, format: { with: /\A[A-z\s]+\z/, message: 'must consist of only letters' } validates :address, format: { with: /\A[A-z0-9\s.,-]+\z/, message: 'must consist of letters, digits and ’,’, ‘-’, ‘ ’ only, no special symbols' } validates :zip, length: { maximum: 10 }, format: { with: /\A[0-9]+\z/, message: 'must consist of only digits' } validates :phone, length: { maximum: 20 }, format: { with: /\A^\+[0-9]+\z/, message: "must starts with '+' and consist of only digits" } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
loker-shopping-cart-0.1.3 | app/models/shopping_cart/address.rb |
loker-shopping-cart-0.1.2 | app/models/shopping_cart/address.rb |
loker-shopping-cart-0.1.1 | app/models/shopping_cart/address.rb |