ruby on rails - Menu displayed on all pages, code is replicated in all controllers -


i have collection model. succesfully created _collection.html.erb call <%= render @collections%> in application layout.

my problem in controlers method must add @collections = collection.all

i found very ugly,it make collection scope pain change, , i'm sure missing rails magic way nicer.

is there way have part of layout generated model data without having identical piece of code in aaaallllll controllers?

notice controllers inherit applicationcontroller. use advantage. add before_filter applicationcontroller loads collections.


Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -