PRO 30% Free • Stripe ($15) & Razorpay (₹899)

Standard Controller Actions

Top Course Staff · 1 min read · Web development · PRO · 30% Free Preview Available

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

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.'

30% Free Preview Reached · Unlock Remaining 70%

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.

✓ Full Access to All 160+ Projects
✓ Instant Blur Removal Everywhere
✓ Production Source Code & Blueprints
✓ All Future Deep Dives Included
Instant Unhindered Activation ·
End of Preview · Unlock Complete Blueprint & Source Code

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.

Production AI Blueprints

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.