Module: UserMixins::Identification::ClassMethods

Defined in:
app/models/user_mixins/identification.rb

Instance Method Summary collapse

Instance Method Details

#attributes_used_for_identificationObject

The user may identify himself using one of these attributes.



18
19
20
# File 'app/models/user_mixins/identification.rb', line 18

def attributes_used_for_identification
  [ :alias, :last_name, :name, :email ]
end

#find_all_by_identification_string(identification_string) ⇒ Object

Find all users where the identification string matches one of the attributes given by ‘attributes_used_for_identification`.

This method returns an array of users matching the given login string. In contrast to ‘self.identify`, this returns an array, whereas `self.identify` returns a user object if the match was unique.



29
30
31
32
33
# File 'app/models/user_mixins/identification.rb', line 29

def find_all_by_identification_string( identification_string )
  self.attributes_used_for_identification.collect do |attribute_name|
    self.send( "find_all_by_#{attribute_name}".to_sym, identification_string )
  end.flatten.uniq
end