Class: Pod

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/pod.rb

Class Method Summary collapse

Class Method Details

.find_or_create_by_url(url) ⇒ Object


2
3
4
5
6
7
8
9
10
# File 'app/models/pod.rb', line 2

def self.find_or_create_by_url(url)
  u = URI.parse(url)
  pod = self.find_or_initialize_by_host(u.host)
  unless pod.persisted?
    pod.ssl = (u.scheme == 'https')? true : false
    pod.save
  end
  pod
end