Skip to content

Instantly share code, notes, and snippets.

@jetrubyshared
Last active March 14, 2017 13:41
Show Gist options
  • Save jetrubyshared/76936bb57589b09aad5d03c413cdef04 to your computer and use it in GitHub Desktop.
Save jetrubyshared/76936bb57589b09aad5d03c413cdef04 to your computer and use it in GitHub Desktop.
############
## WRONG ##
############
def some_method
SomeLongClassName.new(params).perform_action if something_true?
# a lot of another code
end
def create
redirect_to(root_path) if @resource.save
end
##############
## RIGHT ##
##############
def some_method
if something_true?
SomeLongClassName.new(params).perform_action
end
# a lot of another code
end
def create
if @resource.save
redirect_to root_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment