Kumar
Kumar

Reputation: 115

Rails, Where should view specific constants be placed?

I have view where I show information through several panels, one panel for each category. I would like to have the list of panels-to-show in a constant/variable/container which the view can access and show only those panels.

(At least so far) This list of panels is specific to this view.

What is the right place to store such view specific configuration? Some choices I can think of are (i) variables in the controller action (related to that view) (ii) in the view helper method (iii) in the view itself

Thanks, Kumar

Upvotes: 1

Views: 177

Answers (2)

Chakreshwar Sharma
Chakreshwar Sharma

Reputation: 2610

Create a file in config/initializers/constant.rb

Put your all CONSTANT here

Upvotes: 2

Jeremy Le Massu
Jeremy Le Massu

Reputation: 21

When I create a website with configuration like you're looking for, I use a Configuration Store.

Try / Take a look at the following gem : https://github.com/chatgris/Gaston

Upvotes: 1

Related Questions