Hi,
I’m creating a simple Ruby on Rails based CMS. It will support multiple
languages. Therefore I’ve a table ‘pages’ and a table
‘page_translations’. The table ‘page’ contains a title and body in the
default language, the table ‘page_translations’ contain a title and body
for an other language.
Now I would like to have an easy way to retrieve the title and body of a
page given the current language (stored in the session). I would like to
put this logic in a model (the Page model, or maybe a new model like
‘TranslatedPage’). This way I don’t have to put ugly code in my
controllers and views everytime to fetch the page for the current
language.
However, it seems I can’t access @session from the model. Does anybody
have a good idea on how to implement this?
Thanks in advance!
Greetings,
- Matthias