I’m developing a site compound by a static part and a dynamic one.
I still use things like “link_to(…)”, etc in the static part within
rhtml
files.
In the static part, I don’t have the notion of controller and model.
Reading
some article about the subject, I got the following situation:
- created a controller, let me call it “static”;
- put my rhtml files under app/views/static/.
Except for the “index” page, all the rest are static pages.
The problem is that I have a lot of static pages to write and it would
be
confuse to put all them in this directory.
For instance, if I have a menu with several submenus and each submenus
could
have others subsubmenus, I would like the following structure:
-app/views/static/
- menu1
- menu1/submenu1
- menu1/submenu2
- menu2/
- menu2/submenu1
- menu2/submenu2
- otherfile
I know I could do something like:
-app/views/static/
- menu1
- menu1_submenu1
- menu1_submenu2
But I would prefer the other much cleaner solution.
I first tried some links like:
link_to => ‘id’ => ‘submenu1’
The link worked as I expected, but after noticing it didn’t work, I
remembered that Rails would try to run the action ‘menu1’ with
the ‘submenu1’ as a parameter, but I’m not using this parameter in this
action.
I would not like to write an action for every view I want in a
subdirectory…
What would be the Rails way to achieve what I want?
I want Rails to render all the remaining url after the ‘static’
controller
as the local url after app/views/static.
Let me know if I was not clear. Sorry for the big message, but I
couldn’t
make my question clear enough in a small message.
Thanks in advance,
Rodrigo.