Class: Blogelator::Post
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Blogelator::Post
- Defined in:
- app/models/blogelator/post.rb
Instance Method Summary collapse
-
#to_param ⇒ String
Uses the slug as the :id parameter in URLs.
-
#url(request = nil) ⇒ String
The URL for the blog post.
Instance Method Details
#to_param ⇒ String
Uses the slug as the :id parameter in URLs
38 39 40 |
# File 'app/models/blogelator/post.rb', line 38 def to_param slug end |
#url(request = nil) ⇒ String
The URL for the blog post.
44 45 46 47 48 49 50 51 52 |
# File 'app/models/blogelator/post.rb', line 44 def url(request = nil) @url ||= begin if request.try(:ssl?) "https://#{ENV.fetch('HOST')}/blog/#{slug}" else "http://#{ENV.fetch('HOST')}/blog/#{slug}" end end end |