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
-
tickets should be filtered by status or also with category
-status is a boolean value in the tickets table -
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?