I finally circled back around and started poking at my CoffeeFind /*Ruby on Rails*/ application again. I stayed up way late. I wanted to get the [sort-by-column http://pwizardry.com/devlog/index.cgi/2006/01/06#CoffeeFind_I_Want] feature working and I couldn't quit in the middle. *Lessons learned:* just a random list so I don't forget...
- You have to start WEBrick from inside the application directory, /seems that way anyway.../
- To pass params from view to controller. In the view I do this: /<% link_to "![sort]", :action => "show_ordered_by", :id => by %>/ The param here is "by" which is set up above: /<% by = column.name %>/ I needed to do this because no matter what I did with quotes I couldn't just put /column.name/ as the :id value. This bit of code is used in a loop to put a sort tag on each of the column head cells so I can signal the controller method to sort on that column.
On the controller I have: /def show_ordered_by/ /@reviews = Reviews.find(:all, :order => @params['id'])/ /end/ The @params array has the /id/ value the link will pass.
I had added the /*show_ordered_by*/ method to be the target of the links that will resort the table. I needed a separate view .rhtml file to display it. This file turned out to be identical to the one for the /*sort*/ method that draws the table the first time you view the link. In accordance with the DRY principle I changed the /*sort*/ method to be: /redirect_to :action => 'show_ordered_by', :id => 'id'/ And for good measure I added a /*index*/ method which is identical. This way you just need to use [http://pwizardry.com/review http://pwizardry.com/review]