I am very stuck on this problem. I know there is something simple I am
missing, but I have been staring at it long enough to ask others at
this point.
The code: http://gist.github.com/307323
Basically, I have an assets controller that is only accessible through
users (you cannot view an asset without a user association). There are
three stages to editing an asset, so instead of using the resources
default :edit function and passing in query params, I decided to make
cool named routes (i.e. /users/1/assets/1/edit/class), but I am
getting "failed to generate" errors when I try to call the route I
defined.
Can someone here take a minute and glance at my code to see what the
frak I am doing wrong? I could use another set of eyes on this one.
Thanks,
trv
OK, I figured it out. Dumb mistake: to create an optional format like
you see in `rake routes` as:
classify_user_asset GET /users/:user_id/assets/:id/edit/
class(.:format) {:action=>"classify", :controller=>"assets"}
you would write:
map.with_options :controller => 'assets', :conditions => {:method
=> :get} do |assets|
assets.classify_user_asset '/users/:user_id/assets/:id/edit/
class', :action => 'classify'
assets.classify_user_asset '/users/:user_id/assets/:id/edit/
class.:format', :action => 'classify'
end
I was writing:
map.with_options :controller => 'assets', :conditions => {:method
=> :get} do |assets|
assets.classify_user_asset '/users/:user_id/assets/:id/edit/
class(.:format)', :action => 'classify'
end
because that is what I saw in `rake routes`.
Sorry for the n00b question, but I am glad I figured this out.
Yours,
trv