This project is archived and is in readonly mode.
Path generation with array syntax and resources :as
-
Solly
After looking through the source code, it seems that if the code
Resource.name(or the like) were used instead of
RecordIdentifier.__send__("plural_class_name", record)everything would function well. Unfortunately, after digging for a while, I could not find any way to retrieve a Resource object after it is used in the mapping process. Any ideas?
-
Solly
I'm thinking that the best way to handle this is to have a global hash (like the ActionController::Routing.routes array) that stores aliased path names. The entries would be added when resources :as was called, and then referenced during the call to polymorphic_url. I will work on creating a patch for this.
-
Solly
- Tag changed from rails3 routes, form_for, polymorphic_path, polymorphic_url, rails3, routing to rails3 routes, 3.0, form_for, polymorphic_path, polymorphic_url, rails3, routing
-
Andrew White
- State changed from new to needs-more-info
- Assigned user set to Andrew White
- Importance changed from to Low
Are you looking to just change the url or do you want to change the path helper name as well?
If you just want to change the url then this should do what you want:
resources :teachers do resources :school_classes, :path => 'classes' end -
Santiago Pastorino
- State changed from needs-more-info to open
- Tag changed from rails3 routes, 3.0, form_for, polymorphic_path, polymorphic_url, rails3, routing to rails3 routes, 30, form_for, polymorphic_path, polymorphic_url, rails3, routing
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale