Ruby on Rails - structure in ruby on rails- ruby on rails tutorial - rails guides - rails tutorial - ruby rails
- As Rails follows the MVC pattern Views are where your "templates" are for our actions.
- Ensure that we have a controller articles_controller.rb. For this controller we would have a folder in views called app/views/articles:
app
|-- controllers
| '-- articles_controller.rb
|
'-- views
'-- articles
| |- index.html.erb
| |- edit.html.erb
| |- show.html.erb
| |- new.html.erb
| '- _partial_view.html.erb
|
'-- [...]
Clicking "Copy Code" button will copy the code into the clipboard - memory. Please paste(Ctrl+V) it in your destination. The code will get pasted. Happy coding from Wikitechy - ruby on rails tutorial - rails guides - ruby rails - rubyonrails - learn ruby on rails - team
- This structure allows us to have a folder for each controller.
- When calling an action in our controller the appropriate view will be rendered automatically.
// articles_controller.rb
class ArticlesController < ActionController::Base
def show
end
end
// show.html.erb
<h1>My show view</h1>