1
0
Fork 0

Add some default ordering

This commit is contained in:
Andrew Tomaka 2015-10-08 13:08:45 -04:00
parent a412fcf5d9
commit dae4760a5b
5 changed files with 10 additions and 0 deletions

View file

@ -21,6 +21,8 @@ class Card < ActiveRecord::Base
validates :type, presence: true validates :type, presence: true
validates :awaken_type, presence: true validates :awaken_type, presence: true
default_scope { order(:gameid) }
def dokkan? def dokkan?
dokkan_id != nil dokkan_id != nil
end end

View file

@ -1,4 +1,6 @@
class Character < ActiveRecord::Base class Character < ActiveRecord::Base
validates :name, presence: true, validates :name, presence: true,
uniqueness: { case_sensitive: false } uniqueness: { case_sensitive: false }
default_scope { order(:name) }
end end

View file

@ -3,4 +3,6 @@ class Link < ActiveRecord::Base
validates :name, presence: true, validates :name, presence: true,
uniqueness: true uniqueness: true
default_scope { order(:name) }
end end

View file

@ -1,4 +1,6 @@
class PassiveSkill < ActiveRecord::Base class PassiveSkill < ActiveRecord::Base
validates :name, presence: true validates :name, presence: true
validates :description, presence: true validates :description, presence: true
default_scope { order(:name) }
end end

View file

@ -2,6 +2,8 @@ class SuperAttack < ActiveRecord::Base
validates :name, presence: true validates :name, presence: true
validates :description, presence: true validates :description, presence: true
default_scope { order(:name) }
def full def full
"#{name} - #{description}" "#{name} - #{description}"
end end