How to use the slug from Friendly_id in a nested route?

friendly-id, nested-routes, ruby-on-rails, ruby-on-rails-3

Solution

I think it will work if you use this as your url helper instead:

edit_team_video_path(@video.team, @video)

If you give it the id explicitly, that's what it will use.

Problem

I am having a hard time making the slug from Friendly_id in a nested route when editing and creating? the routes look great for show. ``` http://0.0.0.0:3000/test/tester2 ``` This is the URL I am getting when i try to edit tester2 is: ``` http://0.0.0.0:3000/2/tester2/edit ``` What i would like to see is: ``` http://0.0.0.0:3000/test/tester2/edit ``` Here is my code. team.rb ``` class Team < ActiveRecord::Base extend FriendlyId friendly_id :name, use: :slugged has_many :videos ... end ``` video.rb ``` class Video < ActiveRecord::Base extend FriendlyId friendly_id :title, use: :slugged belongs_to :team ... end ``` routes.rb ``` ... resources :teams, :path => '', :except => [:index] do resources :videos, :path => '', :except => [:index] do get 'full_res_download' get 'web_download' end end ... ``` Thank you for your help.

Original source