One generally uses I18n to do that though there are other options.
I18n.t('read_text'). Of course it is generally recommended to do that
kind of stuff in your views and have the controllers control.
Norm
On 11/15/2014 06:51 AM, Ankur Kumar 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*
*
*
Thanks.
--
Regards,
Ankur
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/CALSL1ePK267TpYboY8tHuRC7%3DrWxXMtefVxptnLMxbCaVDk8dQ%40mail.gmail.com
<https://groups.google.com/d/msgid/rubyonrails-talk/CALSL1ePK267TpYboY8tHuRC7%3DrWxXMtefVxptnLMxbCaVDk8dQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/5467C4D6.80408%40earthlink.net.
For more options, visit https://groups.google.com/d/optout.