Hi,
I have an Order class which is the root of 2 other STI
classes
class VirtualOrder < Order; end
class ConcreteOrder < Order; end
I also have a single OrdersController and want my Orders,
VirtualOrders and ConcreteOrders to be handled by that controller.
This is something that worked in Rails-2.x.x using old style
routing like this:
map.resources :orders, :member => { :cancel, :return }
map.resources :virtual_orders, :as => :orders
map.resources :concrete_orders, :as => :orders
This allowed my to do a:
link_to "here", @polymorpic_order
Which is - imho - expected behaviour.
Now I am in the middle of migrating my project to Rails3 and my
resources look like this:
resources :orders do
member do
get :return, :cancel
end
end
resources :virtual_orders, :as => "orders"
resources :concrete_orders, :as => "orders"
I fully expected to still be feeding duck-typed objects into
link_to and get the link to work. Now that still is true,
but;
undefined method concrete_order_path for #<#<Class:0xe265be8>:0xe25bae4>
get's raised
Obviously making a helper for that fixes my problem real easily
but that would only be KISS, not DRY (and I don't like wet
kisses... ;->)
And now, to get down to it, is this a bug? Or was it a bug in
Rails2?