Created
July 17, 2014 18:56
-
-
Save magicmarkker/925f603fa6ec5d8b29ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # routes.rb | |
| resources :committees, as: :workrooms, path: :workrooms do | |
| resources :meetings, concerns: :bookable | |
| end | |
| # Generates | |
| # workroom_meeting_book GET /workrooms/:workroom_id/meetings/:meeting_id/books/:id( | |
| polymorphic_path([@workroom, @meeting, @book]) | |
| # But since @workroom is really a Committee model | |
| # It's generating: committee_meeting_book_path :( |
Author
Author
Lame, trying to refactor all of these if/else to get rid of some code smell
Author
Fixed it by changing the route to this:
resources :workrooms, as: :committees
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@r38y
@workroomis a Committee AR result, same with meeting and book, however, if I remove@workroomit works because the other two models aren't aliased.@workroomis really thecommittee.rbmodel file, but I have it aliased in the routes file. Thepolymorphic_pathis what im using to redirect instead of having 5if/elseredirects in all of my controllers.