Search code examples
ruby-on-railsruby-on-rails-3rubygemsruby-on-rails-plugins

Organizing the view directory in ruby on rails 3


I have a pages controller and my pages view directory.

Say I have a settings page that when visited displays a few links e.g. privacy, notifications, etc. When each link is click the content of the pages for those links are loaded within the same page.

Now in my pages view directory I want to organize things slightly. So instead of having the pages directory and all the view templates in that directory. I would like to have "pages" then "settings" then in the settings directory I would like to place my views files "privacy.html.erb", "notifications.html.erb" etc.

How can I do this and still have rails 3 know what view file to load?


Solution

  • Just using good old render:

    render 'pages/settings/privacy'
    

    to load privacy.html.erb.