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
Post a Comment