Created
May 1, 2019 03:36
-
-
Save bibhuticoder/669617a388e8ef28927cd76b2f54da76 to your computer and use it in GitHub Desktop.
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
class ExampleController < ApplicationController | |
def action_1 | |
res_1; return if performed? | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
def action_2 | |
res_1; return if performed? | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
def action_3 | |
res_2; return if performed? | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
def action_4 | |
res_2; return if performed? | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
private | |
def res_1 | |
# perform some operations | |
render json: {message: 'Failed'}, status: 400 unless operation1_successful? | |
end | |
def res_2 | |
# perform some operations | |
render json: {message: 'Failed'}, status: 400 unless operation1_successful? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment