Y
Y
Yauheni Dakuka2015-08-12 23:56:15
Ruby on Rails
Yauheni Dakuka, 2015-08-12 23:56:15

How to always call the same controller method for all pages?

Essence: there is a main page for which quizzes_controller is responsible. In the header, which is rendered separately from the content, the information from @categories is output using the each iterator. It happens that the content changes, i.e. controllers other than quizzes_controller, for example, results_contoller, are responsible for displaying information on it.
Question: Is it possible to make all pages pass @categories from categories_controller?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
TyzhSysAdmin, 2015-08-13
@ydakuka

I poorly understood what it was about, but from what I understood, I think that this is the option when it is worth moving the function of interest to helpers. :)

I
Ivan Nesterovich, 2015-08-13
@vanderv

I didn't understand much either. Maybe call before_action in application_controller?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question