Last active
August 29, 2015 13:57
-
-
Save nicolaslazartekaqui/9832333 to your computer and use it in GitHub Desktop.
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
# files_controller.rb | |
class FilesController < ApplicationController | |
def index | |
@files = Files.all | |
end | |
... | |
end |
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
# posts/files_controller.rb | |
class Posts::FilesController < ApplicationController | |
def index | |
@posts = Post.find(params[:post_id]) | |
@files = @post.files | |
end | |
... | |
end |
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
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
this way you prevent some conditionals are made to happen your action and keeps the controller most organized