-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This module was a pretend shared behavior while the inlcuding classes were not related. Eventually we'll replace some of the default scopes with regular sorting scopes since default scopes often cause issues.
- Loading branch information
Showing
5 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
class Spree::StoreCreditReason < Spree::Base | ||
include Spree::NamedType | ||
scope :active, -> { where(active: true) } | ||
default_scope -> { order(arel_table[:name].lower) } | ||
|
||
validates :name, presence: true, uniqueness: { case_sensitive: false, allow_blank: true } | ||
|
||
has_many :store_credit_events, inverse_of: :store_credit_reason | ||
end |