Skip to content

Commit

Permalink
Order menu.links association by position automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Gagné committed Dec 10, 2014
1 parent 8ad0bdb commit 2c7ef40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/georgia/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Menu < ActiveRecord::Base

validates :name, presence: true

has_many :links, dependent: :destroy
has_many :links, -> { order(position: :asc) }, dependent: :destroy
accepts_nested_attributes_for :links, allow_destroy: true

def self.policy_class
Expand Down

0 comments on commit 2c7ef40

Please sign in to comment.