Project

General

Profile

« Previous | Next » 

Revision 60e2072a

Added by Joseph Magen almost 11 years ago

  • ID 60e2072a7751819b1d870681294e3feff3de3cbf

fixes #2801 - remove LOWER in default_scope of models that could cause PG error

View differences:

app/models/fact_name.rb
scope :no_timestamp_fact, :conditions => ["fact_names.name <> ?",:_timestamp]
scope :timestamp_facts, :conditions => ["fact_names.name = ?", :_timestamp]
default_scope :order => 'LOWER(fact_names.name)'
default_scope :order => 'fact_names.name'
validate :name, :uniqueness => true
app/models/model.rb
before_destroy EnsureNotUsedBy.new(:hosts)
validates_uniqueness_of :name
validates_presence_of :name
default_scope :order => 'LOWER(models.name)'
default_scope :order => 'models.name'
scoped_search :on => :name, :complete_value => :true, :default_order => true
scoped_search :on => :info
app/models/operatingsystem.rb
before_save :deduce_family
audited :allow_mass_assignment => true
default_scope :order => 'LOWER(operatingsystems.name)'
default_scope :order => 'operatingsystems.name'
scoped_search :on => :name, :complete_value => :true
scoped_search :on => :major, :complete_value => :true
app/models/ptable.rb
validates_uniqueness_of :name
validates_presence_of :layout
validates_format_of :name, :with => /\A(\S+\s?)+\Z/, :message => N_("can't be blank or contain trailing white spaces.")
default_scope :order => 'LOWER(ptables.name)'
default_scope :order => 'ptables.name'
scoped_search :on => :name, :complete_value => true, :default_order => true
scoped_search :on => :layout, :complete_value => false
app/models/usergroup.rb
# The text item to see in a select dropdown menu
alias_attribute :select_title, :to_s
default_scope :order => 'LOWER(usergroups.name)'
default_scope :order => 'usergroups.name'
scoped_search :on => :name, :complete_value => :true
validate :ensure_uniq_name
test/unit/host_test.rb
end
end
test "can auto-complete searches by facts" do
as_admin do
completions = Host::Managed.complete_for("facts.")
FactName.order(:name).each do |fact|
assert completions.include?(" facts.#{fact.name} "), "completion missing: #{fact}"
end
end
end
test "#rundeck returns hash" do
h = hosts(:one)
rundeck = h.rundeck

Also available in: Unified diff