Skip to content

Commit

Permalink
Merge pull request #192 from drhenner/local_edits
Browse files Browse the repository at this point in the history
Local edits
  • Loading branch information
drhenner committed Apr 26, 2018
2 parents 0b635be + f0718c4 commit 3db5a29
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion app/models/batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#

class Batch < ApplicationRecord
belongs_to :batchable, :polymorphic => true
belongs_to :batchable, polymorphic: true
has_many :transactions


Expand Down
4 changes: 2 additions & 2 deletions app/models/cart_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
10 changes: 5 additions & 5 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions app/models/country.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ def abbrev_and_name
end

def self.active
where(:active => true)
where(active: true)
end
# Finds all the countries for a form select .
#
# @param none
# @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
Expand Down
4 changes: 2 additions & 2 deletions app/models/coupon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions app/models/image_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#

class ImageGroup < ApplicationRecord
#attr_accessible :name, :product_id, :images_attributes

validates :name, presence: true
validates :product_id, presence: true

Expand Down
1 change: 0 additions & 1 deletion app/models/order_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion app/models/phone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions app/models/referral_program.rb
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 0 additions & 1 deletion app/models/return_authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/variant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require 'rails-controller-testing'

0 comments on commit 3db5a29

Please sign in to comment.