I have two models - Team and Campaign.
Team has_many :campaigns
& Campaign belongs_to :team
Using friend_id gem, I have my team routes working as expected i.e https://localhost/t/myteam
However, for campaign_path(@campaign.team, @campaign)
my url shows up as http://localhost/t/1/campaign/1 while I am expecting it to be http://localhost/t/myteam/campaign/1
How can I achieve this? What am I doing wrong?
Sharing snippet of my routes code.
resources :teams, :path => 't' do
member do
get :new_invite
resources :campaigns, :path => 'c' do
member do
get :share_callback
get :enter
end
end
end
end
Campaign.rb
extend FriendlyId
friendly_id :campaign_heading, use: :slugged
belongs_to :team
Team.rb
extend FriendlyId
friendly_id :slug, use: :slugged