Module: Devise::Models::WindAuthenticatable::ClassMethods
- Defined in:
- lib/devise_wind/model.rb
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
47 48 49 50 |
# File 'lib/devise_wind/model.rb', line 47 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
52 53 54 55 56 57 |
# File 'lib/devise_wind/model.rb', line 52 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
42 43 44 |
# File 'lib/devise_wind/model.rb', line 42 def validate_wind_login(value = true) self.validates wind_login_field, :presence => value end |
#wind_host(value = nil) ⇒ Object Also known as: wind_host=
33 34 35 |
# File 'lib/devise_wind/model.rb', line 33 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
23 24 25 |
# File 'lib/devise_wind/model.rb', line 23 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
28 29 30 |
# File 'lib/devise_wind/model.rb', line 28 def wind_service(value=nil) configure_property(:wind_service, value) end |