Revision bb3572ff
Added by Daniel Lobato Garcia over 8 years ago
app/models/fact_value.rb | ||
---|---|---|
end
|
||
}
|
||
|
||
scope :distinct, lambda { select('DISTINCT fact_values.value') }
|
||
scope :required_fields, lambda { includes(:host, :fact_name) }
|
||
scope :facts_counter, lambda {|value, name_id| where(:value => value, :fact_name_id => name_id) }
|
||
scope :with_fact_parent_id, lambda {|find_ids| joins(:fact_name).merge FactName.with_parent_id(find_ids) }
|
||
scope :with_roots, lambda { includes(:fact_name) }
|
||
scope :root_only, lambda { with_roots.where(:fact_names => {:ancestry => nil}) }
|
||
scope :distinct, -> { select('DISTINCT fact_values.value') }
|
||
scope :required_fields, -> { includes(:host, :fact_name) }
|
||
scope :facts_counter, ->(value, name_id) { where(:value => value, :fact_name_id => name_id) }
|
||
scope :with_fact_parent_id, ->(find_ids) { joins(:fact_name).merge FactName.with_parent_id(find_ids) }
|
||
scope :with_roots, -> { includes(:fact_name) }
|
||
scope :root_only, -> { with_roots.where(:fact_names => {:ancestry => nil}) }
|
||
|
||
validates :fact_name_id, :uniqueness => { :scope => :host_id }
|
||
|
Also available in: Unified diff
Refs #3809 - Stabby lambda syntax for oneliners
I started by spotting log.rb which didn't have a lambda wrapping its
default scope, as needed by Rails 4. Since the style guide and most
Rails 4 documents used the stabby lambda, I turned on the cop so that we
use it everywhere there's a oneliner lambda.