To summarize: In my rails 2.3.8 app, which uses restful_authentication, all
model error messages (and there are a lot) work exactly as desired except
for the scenario where a new user is signing up for the first time.
Unfortunately this leaves potential new users with a really bad impression.

For example, if the new user fails to enter a matching password - password
confirmation, or makes any other entry error (no password, no login, etc),
the message is like the following:
1 error prohibited this user from being saved

There were problems with the following fields

   - {{attribute}} {{message}}


The {{attribute}}{{message}} isn't translated. And yes I know to use %{} and
not {{}} in en.yml.  Clearly there is something I am doing wrong but I've
exhausted my ideas. Last I tried was as follows, which is an excerpt from
by_password.rb:

module Authentication
  module ByPassword
    # Stuff directives into including module
    def self.included(recipient)
      recipient.extend(ModelClassMethods)
      recipient.class_eval do
        include ModelInstanceMethods

        # Virtual attribute for the unencrypted password
        attr_accessor :password
        validates_presence_of     :password,
:message=>I18n.t(:passwordpresent), :if => :password_required?
        validates_presence_of     :password_confirmation,
:message=>I18n.t(:confirmation), :if => :password_required?
        validates_confirmation_of :password,
 :message=>I18n.t(:confirmation), :if => :password_required?
        validates_length_of       :password, :within => 6..40,
:message=>I18n.t(:passwordlength), :if => :password_required?
        before_save :encrypt_password
      end
    end # #included directives

# Note the addition of i18n.t() calls.

thanks
- James

-- 
You received this message because you are subscribed to the Google Groups 
"rails-i18n" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-i18n?hl=en.

Reply via email to