In Ruby, private methods cannot be called with an explicit receiver. Therefore, you cannot call self.check_url . Instead, just call check_url .
Another problem is that you defined check_url as an instance method and called it in the class method. Move check_url to class << self :
class << self def is_url_valid(url) unless link = Link.find_by_url(url) link = Link.create!(:url => url, :is_valid => check_url(url)) end link.is_valid end private
miaout17
source share