Last active
December 14, 2015 06:29
-
-
Save danott/5042731 to your computer and use it in GitHub Desktop.
An idea on writing readable controller code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ActionController#action arguments as documentation. | |
# | |
# I've been writing controller#action method definitions with inline arguments | |
# on a recent project. I started taking this approach to provide an at-a-glance | |
# "documentation" on what inputs an action is expecting to interact with in | |
# the course of it's execution. | |
class IdeaController < ActionController::Base | |
def take_action(email = params[:email], password = params[:password]) | |
# Take some action with email and password | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment