Created
January 25, 2009 18:13
-
-
Save cypok/52485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Authlogic | |
module Session | |
# = ActiveRecord Trickery | |
# | |
# Authlogic looks like ActiveRecord, sounds like ActiveRecord, but its not ActiveRecord. That's the goal here. This is useful for the various rails helper methods such as form_for, error_messages_for, or any | |
# method that expects an ActiveRecord object. The point is to disguise the object as an ActiveRecord object so we have no problems. | |
module ActiveRecordTrickery | |
def self.included(klass) # :nodoc: | |
klass.extend ClassMethods | |
klass.send(:include, InstanceMethods) | |
end | |
module ClassMethods # :nodoc: | |
# this method was added | |
def human_name(*args) | |
klass.human_name(*args) | |
end | |
def human_attribute_name(*args) | |
klass.human_attribute_name(*args) | |
end | |
end | |
module InstanceMethods # :nodoc: | |
def new_record? | |
new_session? | |
end | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserSession < Authlogic::Session::Base | |
acts_as_translatable_model | |
login_blank_message "не должен быть пустым" | |
login_not_found_message "не найден" | |
password_blank_message "не должен быть пустым" | |
password_invalid_message "неверный" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment