Project

General

Profile

« Previous | Next » 

Revision bb3572ff

Added by Daniel Lobato Garcia over 8 years ago

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.

View differences:

app/models/fact_name.rb
has_many :fact_values, :dependent => :destroy
has_many_hosts :through => :fact_values
scope :no_timestamp_fact, lambda { where("fact_names.name <> ?",:_timestamp) }
scope :timestamp_facts, lambda { where(:name => :_timestamp) }
scope :no_timestamp_fact, -> { where("fact_names.name <> ?",:_timestamp) }
scope :timestamp_facts, -> { where(:name => :_timestamp) }
scope :with_parent_id, lambda { |find_ids|
conds, binds = [], []
[find_ids].flatten.each do |find_id|
......
where(conds.join(' OR '), *binds)
}
default_scope lambda { order('fact_names.name') }
default_scope -> { order('fact_names.name') }
validates :name, :uniqueness => { :scope => :type }

Also available in: Unified diff