As far will_paginate is concerned check this
http://nasir.wordpress.com/2007/10/31/pagination-in-ruby-on-rails-using-will_paginate-plugin/
I will leave the other question for someone else to answer ;o)
On Nov 22, 8:41 pm, Greg Fitzgerald
<netzda...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> 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.
>
> def index
> @posts = Post.paginate :per_page => 3,
> :page => params[:page],
> :order => ''created_at
DESC''
> end
>
> 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.
>
> def archive
> @posts = Post.find_by_date(params[:year], params[:month], params[:day])
> end
>
> This way I now havehttp://localhost:3000/2007/11/01for my archive
> urls.
>
> 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.
>
> --gregf
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---