Sha256: 04fe803f964d88b7bfe76694ee1a0d7be0b349ee1fe50868e03904fdd13e01e6

Contents?: true

Size: 797 Bytes

Versions: 28

Compression:

Stored size: 797 Bytes

Contents

class UsersController < ApplicationController
  before_action :set_user

  def index
    @users = User.all
  end

  def show
  end

  def new
  end

  def create
    if @user.save
      flash[:notice] = t(".user_was_created")
      redirect_to user_path(@user)
    else
      flash[:error] = @user.errors.full_messages.join(". ")
      render :new
    end
  end

  def edit
  end

  def update
    if @user.update_attributes(user_params)
      flash[:notice] = controller_t(".user_was_updated")
      redirect_to user_path(@user)
    else
      flash[:error] = @user.errors.full_messages.join(". ")
      render :edit
    end
  end

private

  def set_user
    @user = User.find(params[:id].to_i) if params[:id].to_i > 0
  end

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

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
awesome_translations-0.0.53 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.52 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.51 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.50 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.49 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.48 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.47 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.46 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.45 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.44 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.43 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.42 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.41 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.40 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.39 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.38 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.37 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.36 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.35 spec/dummy/app/controllers/users_controller.rb
awesome_translations-0.0.34 spec/dummy/app/controllers/users_controller.rb