diff options
| author | mo k <mo.khan@gmail.com> | 2014-10-19 21:14:15 -0600 |
|---|---|---|
| committer | mo k <mo.khan@gmail.com> | 2014-10-19 21:14:15 -0600 |
| commit | 0b72ec4390408fcb5a7d28e33aea2fee0323d136 (patch) | |
| tree | d0efc934b8bae7a7e7690c315447bf30009f7a77 /app/controllers/admin/users_controller.rb | |
| parent | e35346c2d01bbab7e9cd98d639b6bf9b0b7752a7 (diff) | |
| parent | 7f1e33c2fa3a15174e10887d58fbec81982d8cc1 (diff) | |
Merged in mocheen/cakeside/stuff (pull request #112)
search and stuff
Diffstat (limited to 'app/controllers/admin/users_controller.rb')
| -rw-r--r-- | app/controllers/admin/users_controller.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index d0639d00..d0ddb642 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,11 +1,30 @@ module Admin class UsersController < AdminController + def initialize(repository = Spank::IOC.resolve(:users)) + @repository = repository + super() + end + def index - @users = User.search_by(params[:q]) + @users = repository.search_with(params) end def show - @user = User.includes(creations: :photos).find(params[:id]) + @user = repository.includes(creations: [:photos, :tags]).find(params[:id]) + end + + def update + @user = User.find(params[:id]) + @user.update(secure_params) + redirect_to :back end + + private + + def secure_params + params.require(:user).permit(:name, :email, :city, :full_address, :website, :twitter, :facebook) + end + + attr_reader :repository end end |
