diff --git a/app/models/batch.rb b/app/models/batch.rb index 624ade10d..abf68fabd 100644 --- a/app/models/batch.rb +++ b/app/models/batch.rb @@ -21,7 +21,7 @@ # class Batch < ApplicationRecord - belongs_to :batchable, :polymorphic => true + belongs_to :batchable, polymorphic: true has_many :transactions diff --git a/app/models/cart_item.rb b/app/models/cart_item.rb index da7182c4f..6c29b6671 100644 --- a/app/models/cart_item.rb +++ b/app/models/cart_item.rb @@ -53,7 +53,7 @@ def total # @param [none] # @return [Boolean] def inactivate! - self.update_attributes(:active => false) + self.update_attributes(active: false) end # Call this method to determine if an item is in the shopping cart and active @@ -79,6 +79,6 @@ def self.before(at) private def inactivate_zero_quantity - active = false if quantity == 0 + self.active = false if quantity == 0 end end diff --git a/app/models/comment.rb b/app/models/comment.rb index ae65df322..8885a0086 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -13,12 +13,12 @@ # class Comment < ApplicationRecord - belongs_to :commentable, :polymorphic => true + belongs_to :commentable, polymorphic: true belongs_to :user - belongs_to :author, :class_name => 'User', :foreign_key => "created_by" - belongs_to :user, :counter_cache => true + belongs_to :author, class_name: 'User', foreign_key: "created_by" + belongs_to :user, counter_cache: true - validates :note, presence: true, :length => { :maximum => 1255 } + validates :note, presence: true, length: { maximum: 1255 } validates :commentable_type, presence: true - #validates :commentable_id, presence: true + # validates :commentable_id, presence: true end diff --git a/app/models/country.rb b/app/models/country.rb index 638670da6..84d6edd9f 100644 --- a/app/models/country.rb +++ b/app/models/country.rb @@ -39,7 +39,7 @@ def abbrev_and_name end def self.active - where(:active => true) + where(active: true) end # Finds all the countries for a form select . # @@ -47,7 +47,7 @@ def self.active # @return [Array] an array of arrays with [string, country.id] def self.form_selector Rails.cache.fetch("Country-form_selector") do - data = Country.where(:active => true).order('abbreviation ASC').map { |c| [c.abbrev_and_name, c.id] } + data = Country.where(active: true).order('abbreviation ASC').map { |c| [c.abbrev_and_name, c.id] } data.blank? ? [[]] : data end end diff --git a/app/models/coupon.rb b/app/models/coupon.rb index 643fb2f95..532e7afb2 100644 --- a/app/models/coupon.rb +++ b/app/models/coupon.rb @@ -72,11 +72,11 @@ def eligible?(order, at = nil) end def display_start_time(format = :us_date) - starts_at ? I18n.localize(starts_at, :format => format) : 'N/A' + starts_at ? I18n.localize(starts_at, format: format) : 'N/A' end def display_expires_time(format = :us_date) - expires_at ? I18n.localize(expires_at, :format => format) : 'N/A' + expires_at ? I18n.localize(expires_at, format: format) : 'N/A' end private diff --git a/app/models/image_group.rb b/app/models/image_group.rb index 99178e8b3..04c6a14d3 100644 --- a/app/models/image_group.rb +++ b/app/models/image_group.rb @@ -9,8 +9,6 @@ # class ImageGroup < ApplicationRecord - #attr_accessible :name, :product_id, :images_attributes - validates :name, presence: true validates :product_id, presence: true diff --git a/app/models/order_item.rb b/app/models/order_item.rb index b8e416729..3ba7ede94 100644 --- a/app/models/order_item.rb +++ b/app/models/order_item.rb @@ -39,7 +39,6 @@ def set_beginning_values @beginning_total = self.total rescue @beginning_total = nil # this stores the initial value of the total end - #state_machine :initial => 'unpaid' do aasm column: :state do state :unpaid, initial: true state :paid diff --git a/app/models/phone.rb b/app/models/phone.rb index 9f268a6c1..da57639eb 100644 --- a/app/models/phone.rb +++ b/app/models/phone.rb @@ -15,7 +15,6 @@ class Phone < ApplicationRecord include ActionView::Helpers::NumberHelper belongs_to :phone_type - #belongs_to :phone_priority belongs_to :phoneable, polymorphic: true validates :phone_type_id, presence: true diff --git a/app/models/referral_program.rb b/app/models/referral_program.rb index d133ffd23..0d00f4fe6 100644 --- a/app/models/referral_program.rb +++ b/app/models/referral_program.rb @@ -1,13 +1,10 @@ class ReferralProgram < ApplicationRecord - #attr_accessible :active, :description, :name, :referral_bonus_id has_many :referrals belongs_to :referral_bonus - validates :name, presence: true, :length => { :maximum => 40 } - validates :description, presence: true, :length => { :maximum => 600 } + validates :name, presence: true, length: { maximum: 40 } + validates :description, presence: true, length: { maximum: 600 } validates :referral_bonus_id, presence: true - # name - # description delegate :decimal_amount, :to => :referral_bonus diff --git a/app/models/return_authorization.rb b/app/models/return_authorization.rb index 78fe3a2f1..5ab282c38 100644 --- a/app/models/return_authorization.rb +++ b/app/models/return_authorization.rb @@ -48,7 +48,6 @@ class ReturnAuthorization < ApplicationRecord CHARACTERS_SEED = 21 ## after you process an RMA you must manually add the variant back into the system!!! - #state_machine :initial => 'authorized' do aasm column: :state do state :authorized , initial: true state :received diff --git a/app/models/variant.rb b/app/models/variant.rb index a4c3bc345..0fb6298e4 100644 --- a/app/models/variant.rb +++ b/app/models/variant.rb @@ -90,7 +90,7 @@ def active? # record :deleted_at time. if it isn't checked or was unchecked, make it .active? again. def inactivate=(val) return unless val.present? - if val == '1' || val.to_s == 'true' + if val.to_s == '1' || val.to_s == 'true' self.deleted_at ||= Time.zone.now else self.deleted_at = nil diff --git a/config/environment.rb b/config/environment.rb index cf6a144f9..380c3a790 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -36,7 +36,7 @@ ! This is required for the checkout process to work. ! ! Remove or Adjust this warning in /config/environment.rb for developers on your team - ! once you everything working with your specific Gateway. + ! once you have everything working with your specific Gateway. ############################################################################################ " end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index a02f9621b..29100f7ed 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,2 +1,3 @@ +ENV["RAILS_ENV"] ||= 'test' require 'spec_helper' require 'rails-controller-testing'