Revision bb3572ff
Added by Daniel Lobato Garcia over 8 years ago
app/models/usergroup.rb | ||
---|---|---|
|
||
# The text item to see in a select dropdown menu
|
||
alias_attribute :select_title, :to_s
|
||
default_scope lambda { order('usergroups.name') }
|
||
scope :visible, lambda { }
|
||
default_scope -> { order('usergroups.name') }
|
||
scope :visible, -> { }
|
||
scoped_search :on => :name, :complete_value => :true
|
||
validate :ensure_uniq_name, :ensure_last_admin_remains_admin
|
||
|
||
accepts_nested_attributes_for :external_usergroups, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => true
|
||
accepts_nested_attributes_for :external_usergroups, :reject_if => ->(a) { a[:name].blank? }, :allow_destroy => true
|
||
|
||
# This methods retrieves all user addresses in a usergroup
|
||
# Returns: Array of strings representing the user's email addresses
|
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.