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/mail_notification.rb
scoped_search :on => :description, :complete_value => true
scoped_search :in => :users, :on => :login, :complete_value => true, :rename => :user
scope :subscriptable, lambda { where(:subscriptable => true) }
scope :subscriptable, -> { where(:subscriptable => true) }
validates :name, :presence => true, :uniqueness => true
validates :subscription_type, :inclusion => { :in => SUBSCRIPTION_TYPES }, :allow_blank => true
......
validates :method, :presence => true
alias_attribute :mailer_method, :method
default_scope lambda {
order("mail_notifications.name")
}
default_scope -> { order("mail_notifications.name") }
# Easy way to reference the notification to support something like:
# MailNotification[:some_error_notification].deliver(options)

Also available in: Unified diff