我希望访问我在模型中的控制器中设置的变量。想象一下:
app/controllers/events.rb
...
@language = language_from_query_string
@events = Event.all
render "events"
...
app/models/event.rb
...
def title
self["title_#{<reference_to_current_controller>.language}".to_sym]
end
...
无论如何要做到这一点?