-
-
Save rsl/10942188 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
def create | |
# current_user = User.first | |
if moment_params.empty? | |
render status: 406, nothing: true and return | |
else | |
@moment = current_user.moments.build(moment_params) | |
if @moment.save | |
render "moments/show", status: 201 | |
else | |
render status: 422, nothing: true # We should know about things like this. | |
puts "ERROR" | |
end | |
end | |
end | |
# No need for the rescue because you shouldn't expect such an exception. | |
# No need for the explicit returns because Ruby returns on the last statement anyhow. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment