I’m not real sure how I should set this code up to continue on a
restful design. A few related questions. First of all, I want pass
more parameters into will_paginate. No matter how I try it does
not seem to work. My index action looks like this.
@posts = Post.paginate :per_page => 3,
:page => params[:page],
:order => ‘created_at DESC’
First I tried setting @page above @posts with some extra params. I then
tried adding more into the options like params[:page], params[:year],
params[:month], params[:day]. I also tried a few more ideas I had but
they all failed.
I have not been able to pass any extra params into that query so I gave
up on that, and added another action to the posts controller called
archive. Before someone asks I did it with Post.find_by_date.paginate.
Maybe that is the problem to start with I’m not sure.
@posts = Post.find_by_date(params[:year], params[:month],
This way I now have http://localhost:3000/2007/11/01 for my archive
I definitely want to know how I can pass more parameters into
will_paginate, but I also have a design question. Should I move archives
into it’s own controller? Considering I would like to have a few
specialized views for it, plus it breaks the 7 actions limit for a
restful design. I’m unsure about this since they both query the post
table. I also break this design by adding a feed action for my RSS. I
see people break the rules here and there, but I’m unsure when it’s OK
and when it’s not. I have routes setup for all these in
config/routes.rb. Thanks for clearing this up for me.