Created
May 1, 2019 03:35
-
-
Save bibhuticoder/5a810f15179590c81fe0740b165e4311 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 | |
if res1.eql?(false) | |
render json: {message: 'Failed'}, status: 400 unless res_1 | |
return | |
end | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
def action_2 | |
if res1.eql?(false) | |
render json: {message: 'Failed'}, status: 400 unless res_1 | |
return | |
end | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
def action_3 | |
if res2.eql?(false) | |
render json: {message: 'Failed'}, status: 400 unless res_2 | |
return | |
end | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
def action_4 | |
if res2.eql?(false) | |
render json: {message: 'Failed'}, status: 400 unless res_2 | |
return | |
end | |
# rest of the logic.... | |
render json: {data: '...'}, status: 200 | |
end | |
private | |
def res_1 | |
# perform some operations | |
(operation1_successful?) ? true : false | |
end | |
def res_2 | |
# perform some operations | |
(operation2_successful?) ? true : false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment