Standard Controller Actions
Standard Controller Actions
Ruby on Railsdefines seven standard controller actions can be used to do common things such as display and modify data.
Seven actions
If you want to create routes for all seven actions in your app, you can add aresource routeto your routes file. This resource route below maps URLs to the Messages controller’s seven actions (index,show,new,create,edit,update, anddestroy):
resources :messages
Copy to clipboard
resources :messages
If you only want to create routes for specific actions, you can use:onlyto fine tune the resource route. This line maps URLs only to the Message controller’sindexandshowactions.
resources :messages, only: [:index, :show]
Copy to clipboard
resources :messages, only: [:index, :show]
'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'
Complete Payment to Unlock Full Guide & Source Code
You are viewing the 30% preview. Join TopCourseAI Pro to unlock the remaining 70% of this article, unblur all code snippets, and gain full access to all 412 technical projects and guides.
Ready to access the complete step-by-step tutorial?
Gain full unhindered access to all 412 technical projects and guides, unblur all source code snippets, and download runnable scripts.
Related Blueprints & Guides
View all 166 →Accessibility on the Platform
Codecademy is committed to providing a high-quality learning experience for all learners. That includes accommodating different usage forms such as auditory, motor, or visual restrictions, limited hardware, or other acce...
Web developmentAffordances, Signifiers, and Clickability
For users on the web, the mouse click is perhaps the most fundamental human-computer interaction. The webbecamethe web partially through the power ofhypertext, or text in one document that links to other documents or res...
Web developmentAuthentication and OAuth
Authenticationis the process used by applications to determine and confirm identities of users. It ensures that the correct content is shown to users. More importantly, it ensures that incorrect content is secured and u...
Ready to build production-grade AI systems?
Enjoyed this guide? Continue exploring our library of 166+ production blueprints, multi-agent swarms, and autonomous agent systems with 100% unblurred, executable source code.