Skip to content

Instantly share code, notes, and snippets.

@rsl
Forked from andrewfree/mcreate
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsl/10942188 to your computer and use it in GitHub Desktop.
Save rsl/10942188 to your computer and use it in GitHub Desktop.
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