ruby-on-rails-3routesrails-3-upgrade

Rails 2 route unknown to me when porting app to Rails 3


I can't seem to figure out how to port this particular route from Rails 2 to 3:

map.resources :webservices, :new => { :push_data => :post, :reset_url => :post }

The relevant pastie is here: http://pastie.org/4022761


Solution

  • Ok, I see what you are trying to do.
    You need to update your routes.rb file like so:

    resources :webservices do 
        post :push_data, :on => :new
        post :reset_url, :on => :new
    end
    

    I did this to a model I have in a project called Notes, when I called rake routes, it gave me this:

    push_data_new_note POST   /notes/new/push_data(.:format)        notes#push_data
    reset_url_new_note POST   /notes/new/reset_url(.:format)        notes#reset_url
    new_note           GET    /notes/new(.:format)                  notes#new
    

    This should fix your route issue you were having. Let me know how that works out for you.