I am building a rails app. I have a model called Application
.
In application_controller.rb
, I have following function
def create
@application = resource.applications.build(attribute: "value")
if @application.save
//how should i return response code 200?
else
//if @application.save is not run correctly, how do I re-run @application.save?
end
end
I have total two questions.
1) How do I return response code 200 if @application.save is correctly done?
2) If @application.save is not run correctly for some reason, how do I make sure that @application.save is run again to make sure that the @application is eventually saved?
Thanks