On 15 November 2014 13:51, Ankur Kumar <specialankur@gmail.com> wrote:
>
> Hi,
>
> Maybe this is a beginner's question. Can someone please tell me how can I
> reference a en.yml entry in my rails controller? I am able to reference it
> in rails view file as below.
>
> config/locales/en.yml
> ----
> ----
> read_text: "I want to display this text."
> ----
>
> app/views/dashboard/index.html.erb
> ----
> ----
> <%=t :read_text%>
> ---
>
> I want to access read_text: in app/controllers/dashboard_controller.rb
As Norm indicated, the question is why would you want to do this?
Normally that would be done in a view.
Colin
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLufzqEiQKks%2BooNj%2BuZ_QNzKwgz0-%2BKdq2VO9ye_zcJJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment