move the db follower usage to a helper

This commit is contained in:
Josh Kalderimis 2013-05-03 09:21:48 +02:00
parent 546d7b4ad4
commit 23f3edc60c
3 changed files with 15 additions and 2 deletions

View File

@ -10,7 +10,7 @@ class Travis::Api::App
set(:prefix) { "/" << name[/[^:]+$/].underscore }
set disable_root_endpoint: false
register :scoping
helpers :current_user, :flash
helpers :current_user, :flash, :db_follower
# TODO hmmm?
before { flash.clear }

View File

@ -52,7 +52,7 @@ class Travis::Api::App
#
# json(:repository)
get '/:owner_name/:name' do
Octopus.using(:follower) do
prefer_follower do
respond_with service(:find_repo, params)
end
end

View File

@ -0,0 +1,13 @@
require 'travis/api/app'
class Travis::Api::App
module Helpers
module DbFollower
def prefer_follower
Octopus.using(:follower) do
yield
end
end
end
end
end