Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first or create

  • Loading branch information...
commit 397be2fcbab0d6350b737aa0c0e6bbfad6ef228a 1 parent 3d11e33
Sausheong Chang authored
Showing with 1 addition and 2 deletions.
  1. +1 −2  snip.rb
3  snip.rb
View
@@ -5,8 +5,7 @@
post '/' do
uri = URI::parse(params[:original])
raise "Invalid URL" unless uri.kind_of? URI::HTTP or uri.kind_of? URI::HTTPS
- @url = Url.first(:original => uri.to_s)
- @url = Url.create(:original => uri.to_s) if @url.nil?
+ @url = Url.first_or_create(:original => uri.to_s)
haml :index
end
Please sign in to comment.
Something went wrong with that request. Please try again.