How to access multiple models in a single controller

I am creating a customer database. The navigation menu will have
sections for supported customers, trial customers, unsupported
customers, etc. The nav menu will appear on every page.

I need to get the list of customers (i.e., supported customers), but
since I’m not using the company controller, I don’t have access to the
methods that return the Company model data. How can I get the
Application controller to access the Company model?

Thanks,
Richard

You should be able to access your Company model from any controller.

So in my CompanyController, I have functions index, new, edit, create,
show, etc… My understanding is that one of these gets called
depending on the page. If I’m creating a new company, then the new/
create is called, etc. How do I create a function that is called
everytime, regardless of the context?

On Mar 15, 5:53 pm, richardsugg [email protected] wrote:

So in my CompanyController, I have functions index, new, edit, create,
show, etc… My understanding is that one of these gets called
depending on the page. If I’m creating a new company, then the new/
create is called, etc. How do I create a function that is called
everytime, regardless of the context?

Sounds like you are looking for a before_filter

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs