Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Is this unless block really needed? n.attribute?
# Are the 'n.attribute' and 'unless' blocks really needed here?
put '/:id' do
n = Note.get params[:id]
n.content = params[:content]
n.complete = params[:complete] ? 1 : 0
n.updated_at = Time.now
if n.save
redirect '/', :notice => "Note updated thuggishly."
else
redirect '/', :error => 'Update failed, son.'
end
end
put '/:id' do
n = Note.get params[:id]
unless n
redirect '/', :error => "No Note to be found, son."
end
n.attributes = {
:content => params[:content],
:complete => params[:complete] ? 1 : 0,
:updated_at => Time.now #.strftime("%m/%d/%Y %I:%M%p")
}
if n.save
redirect '/', :notice => "Note updated thuggishly."
else
redirect '/', :error => 'Update failed, son.'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.