Sha256: 65ffaceb00a158e97b2e5cb891325e7b1a5a7b550c6527c63ac9f58f49712fc2

Contents?: true

Size: 565 Bytes

Versions: 8

Compression:

Stored size: 565 Bytes

Contents

class UsersController < ApplicationController
  before_action :authenticate_user!
  before_action :correct_user?, :except => [:index]

  def index
    @users = User.all
    authorize User
  end

  def edit
    @user = User.find(params[:id])
  end

  def update
    @user = User.find(params[:id])
    if @user.update_attributes(secure_params)
      redirect_to @user
    else
      render :edit
    end
  end

  def show
    @user = User.find(params[:id])
    authorize @user
  end

  private

  def secure_params
    params.require(:user).permit(:email)
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rails_apps_pages-0.6.7 lib/generators/pages/authorized/templates/omniauth/users_controller.rb
rails_apps_pages-0.6.6 lib/generators/pages/authorized/templates/omniauth/users_controller.rb
rails_apps_pages-0.6.5 lib/generators/pages/authorized/templates/omniauth/users_controller.rb
rails_apps_pages-0.6.4 lib/generators/pages/authorized/templates/omniauth/users_controller.rb
rails_apps_pages-0.6.3 lib/generators/pages/authorized/templates/omniauth/users_controller.rb
rails_apps_pages-0.6.2 lib/generators/pages/authorized/templates/omniauth/users_controller.rb
rails_apps_pages-0.6.0 lib/generators/pages/authorized/templates/omniauth/users_controller.rb
rails_apps_pages-0.5.16 lib/generators/pages/authorized/templates/omniauth/users_controller.rb