Skip to content

Instantly share code, notes, and snippets.

@nicolaslazartekaqui
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolaslazartekaqui/10769643 to your computer and use it in GitHub Desktop.
Save nicolaslazartekaqui/10769643 to your computer and use it in GitHub Desktop.
resources with namespaces
# /app/controllers/images_controller.rb
class ImagesController < ApplicationController
...
def index
@images = Images.all
end
...
end
# /app/controllers/pages/images_controller.rb
class Pages::ImagesController < ApplicationController
...
def index
@page = Page.find(params[:page_id])
@images = @page.images
end
...
end
resources :pages do
resources :images, controller: 'pages/images'
end
resources :images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment