Class: Blogaze::Controllers::MainController
- Inherits:
-
Blogaze::Controller
- Object
- Ramaze::Controller
- Blogaze::Controller
- Blogaze::Controllers::MainController
- Defined in:
- lib/blogaze/controllers/main_controller.rb
Instance Method Summary collapse
-
#index(page = 1) ⇒ Object
Index page.
Methods inherited from Blogaze::Controller
#get_settings, #initialize, #view_file
Constructor Details
This class inherits a constructor from Blogaze::Controller
Instance Method Details
#index(page = 1) ⇒ Object
Index page
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/blogaze/controllers/main_controller.rb', line 18 def index(page = 1) # Check if we should change the title to include # what page we're on. if page.to_i > 1 @title = "Page #{page} - #{@settings[:title]}" else @title = @settings[:title] end # Get the data and paginate it. data = ::Blogaze::Models::Post.order(:published_at.desc) @posts = paginate(data, :limit => @settings[:posts_per_page].to_i, :page => page.to_i) respond(view_file(:index)) end |