“t” method in models and controllers

I’m using the i18n api in my pet project and ran into a little problem: I need to use the “t” method in models and controllers, but I couldn’t since “t” is for views.

I thought about including the views modules where needed, which is very ugly. But, Ryan Bates showed me the solution: If you’re outside the view, call “I18n.translate”.

Advertisement
This entry was posted in en-US and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s