YaleSTC/shifts

View on GitHub
app/models/link.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Link < Notice

    validate :proper_url
  
  def active?
    self.end == nil 
  end

    private
    def proper_url
        if self.url.empty? || self.url == "http://"
            errors.add :base, "Your URL cannot be empty"
        elsif self.url.split.first != self.url
            errors.add :base,  "Your URL cannot have white spaces"
        end
    end
end