Class: Blogelator::Tag

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

Instance Method Summary collapse

Instance Method Details

#to_paramString

Uses the slug as the :id parameter in URLs

Returns:

  • (String)


12
13
14
# File 'app/models/blogelator/tag.rb', line 12

def to_param
  slug
end

#url(request = nil) ⇒ String

The URL for the blog post.

Returns:

  • (String)


18
19
20
21
22
23
24
25
26
# File 'app/models/blogelator/tag.rb', line 18

def url(request = nil)
  @url ||= begin
    if request.try(:ssl?)
      "https://#{ENV.fetch('HOST')}/blog/tags/#{slug}"
    else
      "http://#{ENV.fetch('HOST')}/blog/tags/#{slug}"
    end
  end
end