lib/models/link.rb
def check_link_uniqueness
    if self.uri
      Link.minutes_ago(30).each do |link|
        # Don't check uniqueness against itself
        if link.id != self.id and link.uri == self.uri
          return [false, "Darn, #{link.user} beat you to #{link.uri}."]
        end
      end
    else
      return true
    end
    return true
  end
# Verifies that link hasn't been entered in the last 30 minutes
Verifies that link hasn't been entered in the last 30 minutes
Verifies that link hasn ' t been entered in the last 30 minutes
def check_link_uniqueness
    if self.uri
      Link.minutes_ago(30).each do |link|
        if link.id != self.id and link.uri == self.uri
          return [false, "Darn, #{link.user} beat you to #{link.uri}."]
        end
      end
    else
      return true
    end
    return true
  end
def check_link_uniqueness if self . uri Link . minutes_ago ( 30 ) . each do | link | if link . id != self . id and link . uri == self . uri return [ false , "Darn, #{link.user} beat you to #{link.uri}." ] end end else return true end return true end
Verifies that link hasn't been entered in the last 30 minutes
Verifies that link hasn ' t been entered in the last 30 minutes
# Don't check uniqueness against itself