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/bookmark.rb
:inclusion => {
:in => ["dashboard"] + ActiveRecord::Base.connection.tables.map(&:to_s),
:message => _("%{value} is not a valid controller") }
default_scope lambda { order(:name) }
default_scope -> { order(:name) }
before_validation :set_default_user
scope :my_bookmarks, lambda {
......
where(conditions)
}
scope :controller, lambda { |*args| where("controller = ?", (args.first || '')) }
scope :controller, ->(*args) { where("controller = ?", (args.first || '')) }
def set_default_user
self.owner ||= User.current

Also available in: Unified diff