Class: Blogaze::Controllers::Pages
- Inherits:
-
Controller
- Object
- Ramaze::Controller
- Controller
- Blogaze::Controllers::Pages
- Defined in:
- lib/blogaze/controllers/pages.rb
Instance Method Summary collapse
-
#view(slug = nil) ⇒ Object
View page.
Methods inherited from Controller
#get_settings, #initialize, #title, #view_file
Constructor Details
This class inherits a constructor from Blogaze::Controllers::Controller
Instance Method Details
#view(slug = nil) ⇒ Object
View page
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/blogaze/controllers/pages.rb', line 19 def view(slug = nil) slug = request.env["REQUEST_PATH"] if slug.nil? # Chomp chomp chomp, let's trim any unwanted # forward slashes from the begning and end of the url. slug = slug.chomp("/").reverse.chomp("/").reverse # Get page @page = ::Blogaze::Models::Page[:slug => slug] # Check if the page exists, if not render the # not found page. if @page.nil? title "Not Found" respond(view_file('pages/notfound')) else title @page.title respond(view_file('pages/page')) end end |