Class: Blogaze::Controllers::MainController
- Inherits:
-
Controller
- Object
- Ramaze::Controller
- 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 Controller
#get_settings, #initialize, #title, #view_file
Constructor Details
This class inherits a constructor from Blogaze::Controllers::Controller
Instance Method Details
#index(page = 1) ⇒ Object
Index page
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# 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}" 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 |