diff options
| author | mo khan <mo@mokhan.ca> | 2014-10-15 21:18:21 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-10-15 21:18:21 -0600 |
| commit | f074930fa38a3a7eab617aa128225cb97df27666 (patch) | |
| tree | aa9503cd4324e73bb7dc92e3feedac2217ed37e6 /app/controllers/admin | |
| parent | 23832710014f79be98a25abdc96816e911cd34b4 (diff) | |
extract user repository
Diffstat (limited to 'app/controllers/admin')
| -rw-r--r-- | app/controllers/admin/users_controller.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index d0639d00..f2386854 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,11 +1,20 @@ module Admin class UsersController < AdminController + def initialize(users_repository = Spank::IOC.resolve(:users)) + @users_repository = users_repository + super() + end + def index - @users = User.search_by(params[:q]) + @users = users_repository.search_by(params[:q]) end def show - @user = User.includes(creations: :photos).find(params[:id]) + @user = users_repository.includes(creations: :photos).find(params[:id]) end + + private + + attr_reader :users_repository end end |
