Loenvpy
Loenvpy

Reputation: 919

Rails: Routing in rails 4

I'm creating a rails app in this app I have Companies and each company has many jobs I’m wondering how can I route for all jobs of a company X so I will have a URL like this http://localhost:3000/companies/google/jobs

Upvotes: 0

Views: 52

Answers (1)

Loenvpy
Loenvpy

Reputation: 919

Ok i find the answer this is can be done by using member

  resources :companies do
    member do
      get 'jobs'
    end
  end

this will give the following url

/companies/company_id/jobs 

Upvotes: 1

Related Questions