Title / Description
Code class Admin::UsersController < Admin::ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] respond_to :html def index @admin_users = User.page(params[:page]).per(10) respond_with(@admin_users) end def show respond_with(@admin_user, :layout => !request.xhr?) end def new @admin_user = User.new respond_with(@admin_user) end def edit end def set_agent end def create @admin_user = User.new(user_params) @admin_user.save redirect_to :action => :index, notice: "成功#{I18n.t(action_name)}了#{I18n.t('admin/' + controller_name)}" end def update @admin_user.update_without_password(user_params) redirect_to :action => :index, notice: "成功#{I18n.t(action_name)}了#{I18n.t('admin/' + controller_name)}" end def destroy @admin_user.destroy redirect_to :action => :index, notice: "成功#{I18n.t(action_name)}了#{I18n.t('admin/' + controller_name)}" end private def set_user @admin_user = User.find(params[:id]) end def user_params params.require(:user).permit(:phone, :name, :email, :gender, :role_id, :avatar, :seal) end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code