Adding member or alias to existing path in Rails 3

For the jobs -> apply action I want to "alias" the "create" action.

In rake routes it would look something like this:

I've tried to do it like this but I think this is not exactly what I'm looking for:

  resources :jobs, :only => [:show, :index, :create] do
    resources :apply, :only => [:index, :create] do
      member do 
        post :completed
    resources :share, :only => [:index, :create]

In human words:

When the user submits the page located at "/jobs/<job_id_here>/apply" (the index view) the result page (the create view) should be "/jobs/<job_id_here>/apply/completed" instead of "/jobs/<job_id_here>/apply/" .


When we track users via Google Analytics we can't see if they submitted the form successfully since there is no difference between "/apply" and "/apply" .


Hm, what about using a named route as path

Add a line at the end of your routes.rb

post '/jobs/:job_id/apply/completed', to: apply#create as: apply_job

And then in your new.html.haml

form_for :job, apply_job_path

This should call the create action of your apply controller.

Instead of apply you can use of course any name you want.

Need Your Help

Convert Html or RTF to Markdown or Wiki Compatible syntax?

c# .net api markdown

Is there a .net api that can do this? I saw Pandoc has a standalone exe that I could wrap but I'd rather not if there is something already out there. Any suggestions?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.