Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Fix ambiguous order by 'name' column.
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Mar 7, 2013
1 parent d117ff2 commit 565002d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/node_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.per_page; SETTINGS.classes_per_page end # Pagination
validates_format_of :name, :with => /\A([a-z0-9][-\w]*)(::[a-z0-9][-\w]*)*\Z/, :message => "must contain a valid Puppet class name, e.g. 'foo' or 'foo::bar'"
validates_uniqueness_of :name

default_scope :order => 'name ASC'
default_scope :order => 'node_classes.name ASC'

scope :search, lambda{|q| q.blank? ? {} : {:conditions => ['name LIKE ?', "%#{q}%"]} }

Expand Down
2 changes: 1 addition & 1 deletion app/models/node_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def self.per_page; SETTINGS.groups_per_page end # Pagination
validates_presence_of :name
validates_uniqueness_of :name

default_scope :order => 'name ASC'
default_scope :order => 'node_groups.name ASC'

scope :search, lambda{|q| q.blank? ? {} : {:conditions => ['name LIKE ?', "%#{q}%"]} }

Expand Down

0 comments on commit 565002d

Please sign in to comment.