Class: Page

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/generators/pages/templates/page.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.search(search) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/generators/pages/templates/page.rb', line 18

def self.search(search)
  if search
    find(:all, :conditions => ['name LIKE ? OR content LIKE ? OR page_title LIKE ? OR meta_keywords LIKE ? OR meta_description LIKE ?', "%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%"])
  else
    find(:all)
  end
end

Instance Method Details

#search_result_titleObject



10
11
12
13
# File 'lib/generators/pages/templates/page.rb', line 10

def search_result_title
  r = page_title.split(' | ')
  r[0]
end

#titleObject



6
7
8
# File 'lib/generators/pages/templates/page.rb', line 6

def title
  name.titleize
end