Class: Authlogic::Session::Validation::Errors
- Inherits:
-
Object
- Object
- Authlogic::Session::Validation::Errors
- Defined in:
- lib/authlogic/session/validation.rb
Overview
The errors in Authlogic work JUST LIKE ActiveRecord. In fact, it uses the exact same ActiveRecord errors class. Use it the same way:
class UserSession
validate :check_if_awesome
private
def check_if_awesome
errors.add(:login, "must contain awesome") if login && !login.include?("awesome")
errors.add(:base, "You must be awesome to log in") unless attempted_record.awesome?
end
end
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
18 19 20 21 |
# File 'lib/authlogic/session/validation.rb', line 18 def [](key) value = super value.is_a?(Array) ? value : [value].compact end |