Sha256: 59c33ea99572f392ff1be78287de8759f356df52b1780dcbeb33459b1d669f60

Contents?: true

Size: 770 Bytes

Versions: 6

Compression:

Stored size: 770 Bytes

Contents

module Admin
  class UsersController < Admin::ApplicationController
    # To customize the behavior of this controller,
    # you can overwrite any of the RESTful actions. For example:
    #
    def index
      super
      @resources = User.with_attached_avatars.
        page(params[:page]).
        per(10)
    end

    # Define a custom finder by overriding the `find_resource` method:
    # def find_resource(param)
    #   User.find_by!(slug: param)
    # end

    # See https://administrate-prototype.herokuapp.com/customizing_controller_actions
    # for more information

    def destroy_avatar
      avatar = requested_resource.avatars.find(params[:attachment_id])
      avatar.purge
      redirect_back(fallback_location: requested_resource)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
administrate-field-active_storage-0.3.6 example-project/app/controllers/admin/users_controller.rb
administrate-field-active_storage-0.3.5 example-project/app/controllers/admin/users_controller.rb
administrate-field-active_storage-0.3.4 example-project/app/controllers/admin/users_controller.rb
administrate-field-active_storage-0.3.3 example-project/app/controllers/admin/users_controller.rb
administrate-field-active_storage-0.3.2 example-project/app/controllers/admin/users_controller.rb
administrate-field-active_storage-0.3.1 example-project/app/controllers/admin/users_controller.rb