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/filter.rb
validates_lengths_from_database
default_scope lambda { order(['role_id', "#{self.table_name}.id"]) }
scope :unlimited, lambda { where(:search => nil, :taxonomy_search => nil) }
scope :limited, lambda { where("search IS NOT NULL OR taxonomy_search IS NOT NULL") }
default_scope -> { order(['role_id', "#{self.table_name}.id"]) }
scope :unlimited, -> { where(:search => nil, :taxonomy_search => nil) }
scope :limited, -> { where("search IS NOT NULL OR taxonomy_search IS NOT NULL") }
scoped_search :on => :search, :complete_value => true
scoped_search :on => :limited, :complete_value => { :true => true, :false => false }, :ext_method => :search_by_limited, :only_explicit => true

Also available in: Unified diff