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

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

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.


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

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:

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

Hope that helps explaining things,

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
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
(it’s served as static files).

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

Good luck!

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