Controller methods for app/views/A/B.rhtml

If I want to call A/B, can I call a corresponding controller action for
it?

Like with app/views/A.rhtml, I can it will call the method A in the
controller file.

But with A/B.rhtml, I cant do def A/B.

what are you trying to do by doing def a/b?
as i didn’t quite get the point, the first thing that comes in mind,
regardless to the specifics, is the file routes.rb located in your
config file.

hope this is somewhat useful.

harp

Hey Harper,

Ok, lets say I have an rhtml file in my views directory. The path to
with it is

app/views/picture/mycontent.rhtml. Whenever I call a url to
picture/mycontent, it will look for the controller method titled “def
mycontent.”

What I want to be able to do is have a folder in the picture directory,
so what if I had a file like this:
app/views/picture/mycontent/home.rhtml?

How can I have a controller method called automatically when it is
loaded, I can’t do "def mycontent/home as thats not a valid method
name.

Hope that helps explaining things,
Eric

It doesn’t work that way.

Users don’t actually request RHTML files… Requests go through the
controller first… then the action finds the template.

What you’re doing is probably not a good idea… unless you could
explain
why this structure matters to you. Anything that’s not in the ‘public’
directory (and subfolders of public) of your Rails application is not
accessible to users… but you can’t put Rails or Ruby stuff in that
folder
(it’s served as static files).

Post more about the problem you are trying to solve to the list and I’m
sure
someone will be happy to help you!

Good luck!