Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ricardodovalle/9846404 to your computer and use it in GitHub Desktop.
Save ricardodovalle/9846404 to your computer and use it in GitHub Desktop.
# files_controller.rb
class FilesController < ApplicationController
def index
@files = Files.all
end
...
end
# posts/files_controller.rb
class Posts::FilesController < ApplicationController
def index
@posts = Post.find(params[:post_id])
@files = @post.files
end
...
end
resources :posts do
resources :files, controller: 'posts/files'
end
resources :files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment