-1

So I have a bands table, a festivals table and a bands_festivals table. I am having trouble accesing the show page of the bands_festivals table. This is my routes file:

Ejemplo::Application.routes.draw do

  resources :bands_festivals 

  resources :festivals do  
    resources :band_festivals   
  end 

  resources :bands do  
    resources :band_festivals
  end 

As other people suggested, but I still get the following error:

No route matches {:action=>"show", :controller=>"band_festivals", :id=>#'<'BandFestival band_id: 2, festival_id: 1, year: 1, created_at: "2013-11-20 19:24:38", updated_at: "2013-11-20 19:24:38">}

If you would like to look at my controllers they are here: The "create new entry" page on a many-to-many-relationship

Community
  • 1
  • 1
Zumwan
  • 1
  • 1
  • 4
  • What are you doing before you get that error? Clicking on a link, I assume? If so, what's that `link_to` tag look like? – CDub Nov 20 '13 at 20:14
  • I am accessing localhost:3000/band_festivals. That is the index page for the band_festivals table, where it should show me all my created entries for that table – Zumwan Nov 20 '13 at 23:52

2 Answers2

1

Well your error says there is no route for controller=>"band*a*_festivals" but your routes is drawing for band*s*_festivals like CDub your link may have typo.

Dan Baker
  • 1,757
  • 3
  • 21
  • 36
  • no, thats not it. I just translated everything to english from spanish, and forgot a word. The mistake isn't there. I already edited the output to match the translation – Zumwan Nov 20 '13 at 23:50
1

Your routes has no band_festivals path which isn't namespaced below either festivals or bands. You'll either need to:

a. Change your routes such that you'll have resources :band_festivals...

or

b. Change your view to access the band festivals via bands_festivals.

CDub
  • 13,146
  • 4
  • 51
  • 68