rails_upgrade icon indicating copy to clipboard operation
rails_upgrade copied to clipboard

routes upgrade not handling :controller param/hash/option

Open kimptoc opened this issue 15 years ago • 1 comments

Hi,

I have probably given this the wrong title, but basically this route:

map.resource :account, :controller => "users"

Is converted to this:

resource :account

when it should be this:

resource :account, :controller => "users"

Thanks, Chris

kimptoc avatar Jan 21 '11 21:01 kimptoc

I came across something similar. IMHO, this upgrade:routes task is more likely to do serious harm then actually help with my upgrade. My issue was the path_prefix and name_prefix being completely ignored:

map.with_options :path_prefix => 'tenant_admin', :name_prefix => 'tenant_admin_' do |tenant_admin|

    tenant_admin.resources :users, :controller => "tenant_admin/users",
      :member => {:reset_password => :get, :send_activation => :put, :deactivate => :put, :remove_profile_photo => :put, :remove_from_group => :delete},
      :only => [:index, :edit, :update]
end

That 'users' section was converted to the following at the root level:

  resources :users, :only => [:index, :edit, :update] do
    member do
      put :send_activation
      put :remove_profile_photo
      get :reset_password
      put :deactivate
      delete :remove_from_group
    end
  end

So no path or name prefixes and wrong controller.

phene avatar Sep 26 '11 21:09 phene