namespaced resources
-
Nicholas Rutherford
Second is something I believe would be useful for the case where a group of resources are moved into a namespace and pickle has been used to resolve their paths.
For example if I have two resources books and dvds, and am told they have to be moved under a store/ namespace, then I would change the application code as appropriate, but to update my features I would add
Pickle.config.namespaces[:store] = [:books, :dvds]and this would point "books path" and "dvds path" at the new routes.
It may have hairy edge cases though. Take these paths for example
reviews/ volume/n/reviewsintroduce namespace bulletin/
bulletin/reviews bulletin/volume/n/bulletin/reviews (which is wrong, it should be bulletin/volume/n/reviews) -
Nicholas Rutherford
- Assigned user changed from Ian White to Nicholas Rutherford
Actually the namespacing (in the features) does seem to work. I'll try adding some specs for this.
It would still be nice to have a config option, rather than needing to go through many scenarios explicitly adding the namespace to path_to / pickle paths.
-
Nicholas Rutherford
- State changed from new to open
- Assigned user changed from Nicholas Rutherford to Ian White
This is pretty confusing stuff. It works for some routes and not others.
"Then I should be on the bulletin volume's new article page" works
"When I go to the bulletin volume's page" => undefined method
bulletin_volume's_path' "When I go to the bulletin review's volume's page" => undefined methodbulletin_review's_volume's_path'Having learned more about pickle's path resolution & specced and fiddled a bit I decided to change my app's path_to to know about the namespaces.
#namespacing pickle paths when /^the bulletin #{capture_model}(?:'s)? page$/ # eg. the forum's page path_to_pickle 'bulletin', $1 when /^the bulletin #{capture_model}(?:'s)? #{capture_model}(?:'s)? page$/ # eg. the forum's post's page path_to_pickle 'bulletin', $1, $2 when /^the bulletin #{capture_model}(?:'s)? #{capture_model}'s (.+?) page$/ # eg. the forum's post's comments page path_to_pickle 'bulletin', $1, $2, :extra => $3 # or the forum's post's edit page when /^the bulletin #{capture_model}(?:'s)? (.+?) page$/ # eg. the forum's posts page path_to_pickle 'bulletin', $1, :extra => $2 # or the forum's edit pageIt now resolves the urls correctly.
Abstraction would be a timesaver but seems pretty complex, this at least lets me make my features pass again.Thoughts?
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.