Class: Tramway::SessionForm
- Inherits:
-
ApplicationForm
- Object
- ApplicationForm
- Tramway::SessionForm
- Defined in:
- app/forms/tramway/session_form.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
Attributes inherited from ApplicationForm
Instance Method Summary collapse
-
#initialize(object) ⇒ SessionForm
constructor
A new instance of SessionForm.
- #validate(params) ⇒ Object
Methods inherited from ApplicationForm
add_polymorphic_association, association, #associations, enumerized_attributes, full_class_name_association, full_class_name_associations, model_class, model_class=, #model_name, properties, property, reflect_on_association, validates
Constructor Details
#initialize(object) ⇒ SessionForm
Returns a new instance of SessionForm.
7 8 9 10 11 |
# File 'app/forms/tramway/session_form.rb', line 7 def initialize(object) object = Tramway::User.new unless object.present? super end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'app/forms/tramway/session_form.rb', line 5 def password @password end |
Instance Method Details
#validate(params) ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/forms/tramway/session_form.rb', line 13 def validate(params) (add_wrong_email_or_password_error && return) if model.new_record? (!model.new_record? && model.authenticate(params[:password])).tap do |result| add_wrong_email_or_password_error unless result end end |