Sha256: cfb95681dea66cf410609ae1b7e5184aff4d666e17511b4bcad2082dc8115ebd

Contents?: true

Size: 1.38 KB

Versions: 11

Compression:

Stored size: 1.38 KB

Contents

# encoding: UTF-8

# Copyright 2011 innoQ Deutschland GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

class UsersController < ApplicationController
  load_and_authorize_resource

  def index
    @users = User.find(:all)
  end

  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])

    if @user.save
      flash[:success] = I18n.t('txt.controllers.users.successfully_created')
      redirect_to users_path
    else
      render :action => :new
    end
  end

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

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

    if @user.update_attributes(params[:user])
      flash[:success] = I18n.t('txt.controllers.users.successfully_updated')
      redirect_to users_path
    else
      render :action => :edit
    end
  end

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

    redirect_to users_path
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
iqvoc-4.1.0 app/controllers/users_controller.rb
iqvoc-4.0.9 app/controllers/users_controller.rb
iqvoc-4.0.8 app/controllers/users_controller.rb
iqvoc-4.0.7 app/controllers/users_controller.rb
iqvoc-4.0.6 app/controllers/users_controller.rb
iqvoc-4.0.5 app/controllers/users_controller.rb
iqvoc-4.0.4 app/controllers/users_controller.rb
iqvoc-4.0.3 app/controllers/users_controller.rb
iqvoc-4.0.2 app/controllers/users_controller.rb
iqvoc-4.0.1 app/controllers/users_controller.rb
iqvoc-4.0.0 app/controllers/users_controller.rb