Hello I have product model that has a given workflow (given by state_machine). Then I have 2-3 versions of product that have a slightly different workflow. Since state_machine has a elegant way of handling class inheritance (compared to aasm), I have 2-3 models that inherit from Product. (ProductOne, ProductTwo, etc). The Product model has_many transisions. this is a hm relationship that basically handles all transisions/events RESTfully. I also get transision logging by having this transision model.
My question is how this is implemented as DRY as possible in routes.rb. this is how my routes.rb looks like today: map.resources :products do |product| product.resources :transisions, :only => [ :index, :new, :create ] end map.resources :product_one, :as => 'products', :controller => 'products' do |product| product.resources :transisions, :only => [ :index, :new, :create ] end map.resources :product_two, :as => 'products', :controller => 'products' do |product| product.resources :transisions, :only => [ :index, :new, :create ] end map.resources :product_three, :as => 'products', :controller => 'products' do |product| product.resources :transisions, :only => [ :index, :new, :create ] end Is there a more elegant way to handle this. goal is to have only "products" routes. I do not want separate routes for each variant of product. I tried this but it did not work :-): map.resources :products, :has_many => [ :transisions => { :only => [:index, :new, :create] } ] /MartOn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---