Created
September 16, 2012 05:44
-
-
Save oferreiro/3731163 to your computer and use it in GitHub Desktop.
rota para nested resources dentro de namespace
This file contains 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
namespace :admin do | |
resources :galleries do | |
#resource :images #wrong | |
resources :images #right | |
end | |
end | |
# admin/galleries/show.html.erb | |
# ... | |
<%= render :partial => "/admin/images/image", :collection => @gallery.images %> | |
# ... | |
# admin/images/_image.html.erb | |
<div class="thumb"> | |
<%= image.name %> <br/ > | |
<%= image_tag image.img.url(:thumb) %><br/ > | |
<%= link_to 'Edit', [:admin, @gallery, image], | |
:method => :edit %> | |
<%= link_to 'Delete', [:admin, @gallery, image], | |
:confirm => 'Are you sure?', | |
:class => 'delete-btn', | |
:method => :delete %> | |
</div> | |
This file contains 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
gallery_images GET /galleries/:gallery_id/images(.:format) images#index | |
POST /galleries/:gallery_id/images(.:format) images#create | |
new_gallery_image GET /galleries/:gallery_id/images/new(.:format) images#new | |
edit_gallery_image GET /galleries/:gallery_id/images/:id/edit(.:format) images#edit | |
gallery_image GET /galleries/:gallery_id/images/:id(.:format) images#show | |
PUT /galleries/:gallery_id/images/:id(.:format) images#update | |
DELETE /galleries/:gallery_id/images/:id(.:format) images#destroy | |
galleries GET /galleries(.:format) galleries#index | |
POST /galleries(.:format) galleries#create | |
new_gallery GET /galleries/new(.:format) galleries#new | |
edit_gallery GET /galleries/:id/edit(.:format) galleries#edit | |
gallery GET /galleries/:id(.:format) galleries#show | |
PUT /galleries/:id(.:format) galleries#update | |
DELETE /galleries/:id(.:format) galleries#destroy |
This file contains 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
admin_gallery_images POST /admin/galleries/:gallery_id/images(.:format) admin/images#create | |
new_admin_gallery_images GET /admin/galleries/:gallery_id/images/new(.:format) admin/images#new | |
edit_admin_gallery_images GET /admin/galleries/:gallery_id/images/edit(.:format) admin/images#edit | |
GET /admin/galleries/:gallery_id/images(.:format) admin/images#show | |
PUT /admin/galleries/:gallery_id/images(.:format) admin/images#update | |
DELETE /admin/galleries/:gallery_id/images(.:format) admin/images#destroy | |
admin_galleries GET /admin/galleries(.:format) admin/galleries#index | |
POST /admin/galleries(.:format) admin/galleries#create | |
new_admin_gallery GET /admin/galleries/new(.:format) admin/galleries#new | |
edit_admin_gallery GET /admin/galleries/:id/edit(.:format) admin/galleries#edit | |
admin_gallery GET /admin/galleries/:id(.:format) admin/galleries#show | |
PUT /admin/galleries/:id(.:format) admin/galleries#update | |
DELETE /admin/galleries/:id(.:format) admin/galleries#destroy |
This file contains 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
gallery_images POST /galleries/:gallery_id/images(.:format) images#create | |
new_gallery_images GET /galleries/:gallery_id/images/new(.:format) images#new | |
edit_gallery_images GET /galleries/:gallery_id/images/edit(.:format) images#edit | |
GET /galleries/:gallery_id/images(.:format) images#show | |
PUT /galleries/:gallery_id/images(.:format) images#update | |
DELETE /galleries/:gallery_id/images(.:format) images#destroy | |
galleries GET /galleries(.:format) galleries#index | |
POST /galleries(.:format) galleries#create | |
new_gallery GET /galleries/new(.:format) galleries#new | |
edit_gallery GET /galleries/:id/edit(.:format) galleries#edit | |
gallery GET /galleries/:id(.:format) galleries#show | |
PUT /galleries/:id(.:format) galleries#update | |
DELETE /galleries/:id(.:format) galleries#destroy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment