Class: TagSearchPage
- Inherits:
-
Page
- Object
- Page
- TagSearchPage
- Defined in:
- app/models/tag_search_page.rb
Instance Attribute Summary collapse
-
#requested_tag ⇒ Object
Returns the value of attribute requested_tag.
Instance Method Summary collapse
-
#cache? ⇒ Boolean
“Behavior” methods ####.
- #find_by_path(url, live = true, clean = false) ⇒ Object
- #found_tags ⇒ Object
- #render ⇒ Object
Instance Attribute Details
#requested_tag ⇒ Object
Returns the value of attribute requested_tag.
3 4 5 |
# File 'app/models/tag_search_page.rb', line 3 def requested_tag @requested_tag end |
Instance Method Details
#cache? ⇒ Boolean
“Behavior” methods ####
80 81 82 |
# File 'app/models/tag_search_page.rb', line 80 def cache? true end |
#find_by_path(url, live = true, clean = false) ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'app/models/tag_search_page.rb', line 98 def find_by_path(url, live = true, clean = false) url = clean_url(url).chop # chop off trailing slash added by clean_url if url =~ /^#{self.url}([a-zA-Z0-9,\_\-\s\/()'.&]*)\/?$/ self.requested_tag = $1 self else super end end |
#found_tags ⇒ Object
84 85 86 87 88 89 |
# File 'app/models/tag_search_page.rb', line 84 def return @found_tags if @found_tags return [] if requested_tag.blank? @found_tags = Page.tagged_with(requested_tag).delete_if { |p| !p.published? } end |
#render ⇒ Object
91 92 93 94 95 96 |
# File 'app/models/tag_search_page.rb', line 91 def render self.requested_tag = @request.parameters[:tag] if @request.parameters[:tag] self.title = "#{self.title} #{requested_tag}" if requested_tag super end |