Skip to content

Commit

Permalink
Utilise implicit_order_column à la place de default_scope pour trier …
Browse files Browse the repository at this point in the history
…les modèles avec une colonne par défaut
  • Loading branch information
cprodhomme authored and etienneCharignon committed Jun 7, 2021
1 parent 9f15fda commit 917fc75
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 2 deletions.
1 change: 1 addition & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
self.implicit_order_column = 'created_at'
end
1 change: 0 additions & 1 deletion app/models/campagne.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ class Campagne < ApplicationRecord
belongs_to :questionnaire, optional: true
belongs_to :compte
belongs_to :parcours_type, optional: true
default_scope { order(created_at: :asc) }

validates :libelle, presence: true
validates :code, presence: true, uniqueness: true
Expand Down
1 change: 0 additions & 1 deletion app/models/compte.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Compte < ApplicationRecord
validates :statut_validation, presence: true
validates_presence_of :nom, :prenom, on: :create
validate :verifie_dns_email
default_scope { order(created_at: :asc) }

enum statut_validation: %i[en_attente acceptee refusee], _prefix: :validation

Expand Down

0 comments on commit 917fc75

Please sign in to comment.