Class: Humpyard::NewsItem
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Humpyard::NewsItem
- Defined in:
- app/models/humpyard/news_item.rb
Instance Method Summary collapse
-
#human_url(options = {}) ⇒ Object
Return the human readable URL for the page.
Instance Method Details
#human_url(options = {}) ⇒ Object
Return the human readable URL for the page.
Posible options values are
:locale-
A locale given in the Humpyard::Config.locales. If no
:localeis given the option will be ::I18n.locale by default
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/models/humpyard/news_item.rb', line 21 def human_url(={}) [:locale] ||= ::I18n.locale [:format] ||= :html unless Humpyard::config.locales.include? [:locale].to_sym [:locale] = Humpyard::config.locales.first end if [:path_format] format = "/" else format = ".#{[:format].to_s}" end = [:path_format] = true "#{news_page.page.human_url()}#{created_at.strftime '%Y/%m/%d'}/#{query_title_for_url([:locale])}#{format}" end |