Project

General

Profile

« Previous | Next » 

Revision 3ab02530

Added by Kavita Gaikwad over 7 years ago

Fixes #12547 - Added validators to interger fields

With this commit, instead of postgresql exception it will
show proper validation message for interger fields.

View differences:

app/models/hostgroup.rb
scoped_search :relation => :hosts, :on => :name, :complete_value => :true, :rename => "host"
scoped_search :relation => :puppetclasses, :on => :name, :complete_value => true, :rename => :class, :operators => ['= ', '~ ']
scoped_search :relation => :environment, :on => :name, :complete_value => :true, :rename => :environment
scoped_search :on => :id, :complete_enabled => false, :only_explicit => true
scoped_search :on => :id, :complete_enabled => false, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
# for legacy purposes, keep search on :label
scoped_search :on => :title, :complete_value => true, :rename => :label
scoped_search :relation => :config_groups, :on => :name, :complete_value => true, :rename => :config_group, :only_explicit => true, :operators => ['= ', '~ '], :ext_method => :search_by_config_group
......
scoped_search :relation => :operatingsystem, :on => :title, :complete_value => true, :rename => :os_title
scoped_search :relation => :operatingsystem, :on => :major, :complete_value => true, :rename => :os_major
scoped_search :relation => :operatingsystem, :on => :minor, :complete_value => true, :rename => :os_minor
scoped_search :relation => :operatingsystem, :on => :id, :complete_enabled => false, :rename => :os_id, :only_explicit => true
scoped_search :relation => :operatingsystem, :on => :id, :complete_enabled => false, :rename => :os_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
scoped_search :relation => :medium, :on => :name, :complete_value => true, :rename => "medium"
scoped_search :relation => :provisioning_templates, :on => :name, :complete_value => true, :rename => "template"
end

Also available in: Unified diff