-
-
Save dminuoso/c76e66ee8ba6e04be07e46b66d690212 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
# Controller ~> LopParams -> HttpResponse | |
def make_lop(lop_params) | |
errs = [] | |
house = House.find_or_initialize_by( | |
... | |
) | |
if !house.valid? | |
return { status: 422, body: house.errors.full_messages } | |
end | |
lop = LoP.new({ | |
... | |
}) | |
if !lop.valid? | |
return { status: 422, body: lop.errors.full_messages } | |
end | |
house.save! | |
lop.save! | |
return { status: 200, body: nil } | |
rescue => e | |
logger.error e.message | |
logger.error e.backtrace.join("\n") | |
return { status: 500, body: "Unbekannter Fehler bei der Verarbeitung" } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment