move the db follower usage to a helper
This commit is contained in:
parent
546d7b4ad4
commit
23f3edc60c
|
@ -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 }
|
||||
|
|
|
@ -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
|
||||
|
|
13
lib/travis/api/app/helpers/db_follower.rb
Normal file
13
lib/travis/api/app/helpers/db_follower.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user