-
-
Save danneu/4050944 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
# config/routes.rb | |
namespace :api, defaults: {format: "json"} do | |
namespace :v1 do | |
resources :wines | |
end | |
end | |
# wines_controller | |
class WinesController | |
def index | |
limit = params[:limit] || nil | |
@wines = Wine.limit(limit) | |
end | |
end | |
api/v1/wines?limit=10 returns 10 wines | |
api/v1/wines returns ALL wines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment