Hi Yaroslav,

I believe it is working as it should, and you can change the model
name. Have a look at the rdoc of the method[1], because if your
instance name is different from the model name, you need to specify
it. We tried to keep the behavior as close to the original as
possible.

I don't like the way this function is set up, it's totally not logical
at all. I would like syntax like error_messages_for(@model_inst).

But then again, the documentation tells us that if we don't like it,
we need to make our own.


Cheers,
Iain
http://iain.nl/

[1] 
http://apidock.com/rails/ActionView/Helpers/ActiveRecordHelper/error_messages_for

On Nov 26, 4:11 pm, "Yaroslav Markin" <[EMAIL PROTECTED]>
wrote:
> Hi guys,
>
> Seems we may have some misunderstanding with error_messages_for.
>
> Given:
>
>   class Model < ActiveRecord::Base
>
>   class HomepageController < ApplicationController
>    def index
>       @model_inst = Model.new
>       # blah blah
>       @model_inst.save
>     end
>   end
>
> and
>
>   <%= error_messages_for :model_inst %>
>
> In view, error_messages_for looks up translation for "model_inst" instead of
> "model".
>
> Proof: active_record_helper.rb, lines 190+
>
> That means that basically my translation tables depend on how is my instvar
> called in controllers.
>
> Is that intended? Should we change it to look for "model" translation?
>
> Iain, could you please share your thoughts?
>
> --
> Yaroslav Markin
--~--~---------~--~----~------------~-------~--~----~
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