[routes] resources with new actions

2 views
Skip to first unread message

Andrew Brown

unread,
Aug 13, 2007, 2:26:10 PM8/13/07
to rubyonra...@googlegroups.com
I'm building a ticketing program and I'm trying to get the following
routes:

tickets/all
tickets/sorted
tickets/unsorted

cat/1/tickets/1
cat/1/tickets/all
cat/1/tickets/sorted
cat/1/tickets/unsorted

currently my routes are:

map.resources :tickets
map.resources :categories do | category |
category.resources :tickets, :name_prefix => 'cat_'
end

1. tickets should be filtered by status or also with category
-status is a boolean value in the tickets table

2. status should retain when changing between categories
-I was thinking of instead of passing around a get for status to store
it instead in a session

Can I get the desired results using resources?
Should I have three actions for the status in my tickets controller?
(all, sorted, unsorted)

Is it possible to call sorted set a session, then call index?

map.resources :tickets, :collection { :all => :get, :unsorted => :get
,:sorted => :get }

<%= link_to 'Sorted', sorted_tickets_path %>

def sorted
# set session call index and render index.rtrml
end

tickets/sorted


I've been scratching my head on this one for a while.
Any suggestions?

Attachments:
http://www.ruby-forum.com/attachment/111/yellow_ticket.gif

--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages