Module: Devise::Models::WindAuthenticatable::ClassMethods
- Defined in:
- lib/devise_wind/model.rb
Overview
InstanceMethods
Instance Method Summary collapse
- #find_by_wind_login_field(login) ⇒ Object
- #find_or_create_by_wind_login_field(login) ⇒ Object
-
#validate_wind_login(value = true) ⇒ Object
(also: #validate_wind_login=)
Whether or not to validate the wind_login field.
- #wind_host(value = nil) ⇒ Object (also: #wind_host=)
-
#wind_login_field(value = nil) ⇒ Object
(also: #wind_login_field=, #wind_service=)
The name of the wind login field in the database.
- #wind_service(value = nil) ⇒ Object
Instance Method Details
#find_by_wind_login_field(login) ⇒ Object
50 51 52 53 |
# File 'lib/devise_wind/model.rb', line 50 def find_by_wind_login_field(login) # we should create a user here if login was valid but record is missing? self.send( ("find_by_" + wind_login_field.to_s).to_sym, login ) end |
#find_or_create_by_wind_login_field(login) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/devise_wind/model.rb', line 55 def find_or_create_by_wind_login_field(login) # we should create a user here if login was valid but record is missing mname = ("find_or_create_by_" + wind_login_field.to_s) Rails.logger.debug "#{self.name}.#{mname}(#{login})" self.send mname.to_sym, login end |
#validate_wind_login(value = true) ⇒ Object Also known as: validate_wind_login=
Whether or not to validate the wind_login field. If set to false ALL wind validation will need to be handled by you.
-
Default:
true -
Accepts:
Boolean
45 46 47 |
# File 'lib/devise_wind/model.rb', line 45 def validate_wind_login(value = true) self.validates wind_login_field, :presence => value end |
#wind_host(value = nil) ⇒ Object Also known as: wind_host=
36 37 38 |
# File 'lib/devise_wind/model.rb', line 36 def wind_host(value=nil) configure_property(:wind_host, value) end |
#wind_login_field(value = nil) ⇒ Object Also known as: wind_login_field=, wind_service=
The name of the wind login field in the database.
-
Default:
:wind_login, :login, or :username, if they exist -
Accepts:
Symbol
26 27 28 |
# File 'lib/devise_wind/model.rb', line 26 def wind_login_field(value = nil) configure_property(:wind_login_field, value, first_column_to_exist(nil, :wind_login, :login, :username)) end |
#wind_service(value = nil) ⇒ Object
31 32 33 |
# File 'lib/devise_wind/model.rb', line 31 def wind_service(value=nil) configure_property(:wind_service, value) end |