Qasem Hajizadeh

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in ruby on rails nested model relationship and routes

I have these models: Sport, Country, League and Match
Also I do have SportsController, CountriesController, LeaguesController and MatchsController

So the question is:
1: how i can set relation between models ?
2: how i can set routs like this

sport/sport_id(slug)/country_id(slug)/league_id(slug)/match_id

sports/soccer/england/premier-league/52346

Note : all of the countries don't have all sports for example Soccer Sport exist in all countries but volleyball exist in some countries

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.