Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Imagine a few slices...
- #
- #
- # Watch out: Merb code ahead
- #
- class PersonProfile
- def create(profile_attributes)
- # ...
- # namespaced/scoped to slice routes table
- redirect slice_url(:profile, @profile)
- end
- end
- class ProjectProfile
- def create(profile_attributes)
- # ...
- # namespaced/scoped to slice routes table
- redirect slice_url(:profile, @profile)
- end
- end
- end
- #
- # Watch out: Rails code ahead
- #
- class PersonProfile
- def create
- # ...
- # namespacing/scoping would take a prefix
- # which means evaluation scope matters => implementation is fairly complex
- redirect_to person_profile_url(@profile)
- end
- end
- class ProjectProfile
- def create
- # namespacing/scoping would take a prefix
- # which means evaluation scope matters => implementation is fairly complex
- redirect_to project_profile_url(@profile)
- end
- end
- end
- #
- # Ideas
- #
- Rails3::Router.prepare do
- slice :person do
- resource :profile
- end
- slice :project do
- resource :profile
- end
- end
- #
- # Results into
- #
- # person_profile_url
- # edit_person_profile_url
- # follow_person_profile_url
- # ...
- #
Add Comment
Please, Sign In to add comment