Reputation: 4193
I have a class, called Tab, that needs access to params so that it can check params[:controller]. Two questions? (1) Where should I put these two classes, Tab and Tabs? Should they be in lib? Or in application_helper.rb? (2) What's an easy way to get access to params in that class? Should I just add a params parameter to the constructor of Tabs and pass params in at the call site?
Upvotes: 0
Views: 172
Reputation: 7288
1) Where should I put these two classes, Tab and Tabs? Should they be in lib? Or in application_helper.rb?
it can go to lib, ideally we keep all custom classes/modules in lib directory.
2) What's an easy way to get access to params in that class?
I think you are right here, you should add a params parameter to the constructor of class and pass params in it.
Upvotes: 1