How to create Urls => Controller

In Rails you use the routes.rb file to map incoming URLs to your controllers and actions.

map.connect '/category/:filter/, :controller => 'categories', :action => 'index'

In your CategoriesController class, you can now inspect params[:filter] to see what (if anything) was specified:

class CatagoriesController < ApplicationController

  def index     if params[:filter]       @items = Item.find_all_by_type(params[:filter)]     else       @items = Item.find :all     end   end

end

and then your index.rhtml can display the @items array.

Jeff softiesonrails.com