How to organize controllers in Rails?

Hello,

I am planning to create a much larger application using Ruby on Rails. I
am stopped after thinking how to organize my controllers. Sure enough I
could make admin/blog as a controller name, but what bothers me is that
I have some link_to calls in my layouts template and it does not get
into the right controller when it is clicked. To give you an insight:

Layout:

<?= link_to 'blog', :controller => 'admin/blog' ?>

admin/blog/index.rhtml

<?= link_to 'Back to Main', :controller => 'home' ?>

When I am in the admin/blog controller and I click that latter anchor,
it would go to:

/admin/home

which should be in:

/home

Why I am doing it that way, is I would have several “modules” like
admin. Any idea how to go around with this?

Thanks,

Junrey B.

Try putting a / in front of controllers, e.g.

<?= link_to 'Back to Main', :controller => '/home' ?>

That’s exactly what I need. Why I haven’t thought of that? hmmm…

Thank you so much…

Joe R. MUDCRAP-CE wrote:

Try putting a / in front of controllers, e.g.

<?= link_to 'Back to Main', :controller => '/home' ?>

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