I have a couple of variables that need to be called in all controllers. Display the latest news in the footer of the layout.
I create them in application_controller.rb
@hq_news_item = NewsItem.where(:branch_code => "CORP").first
@branch_news_item = NewsItem.where(:branch_code => "MN").first
In my mockups /application.html.haml
= render :partial => "layouts/footer_news" , :hq_news_item => @hq_news_item, :branch_news_item => @branch_news_item
And then in my mockups / _footer_news I style them
= hq_news_item.title
= hq_news_item.author.name
... etc
That's what, no matter what I do - he keeps saying that hq_news_item is undefined in partial.
All my other partial works are working fine. I think this is due to the fact that this is a layout, not a view. I can not find anything meaningful in the documents.
Any ideas?
Thank.
source
share