Sha256: a8608dac8a11af0a898d78ab91f7cd07fda520dc49c85ca162d1e418da69537d

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

class UsersController < ApplicationController
  # GET /users
  # GET /users.xml
  def index
    @users = User.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @users }
    end
  end

  # GET /users/1
  # GET /users/1.xml
  def show
    @user = User.find(params[:id])
    @countries = COUNTRIES_HASH

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @user }
    end
  end

  def email_field
    @user = User.find(params[:id])
    render :action => :email_field, :layout => false
  end

  def show_ajax
    @user = User.find(params[:id])
    @countries = COUNTRIES_HASH
  end

  def double_init
    @user = User.find(params[:id])
    @countries = COUNTRIES_HASH
  end

  # GET /users/1/edit
  def edit
    @user = User.find(params[:id])
  end

  # PUT /users/1
  # PUT /users/1.xml
  def update
    @user = User.find(params[:id])

    respond_to do |format|
      if @user.update_attributes(user_params)
        format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
        format.json { respond_with_bip(@user) }
      else
        format.html { render :action => "edit" }
        format.json { respond_with_bip(@user) }
      end
    end
  end


 private

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
best_in_place-3.1.1 spec/internal/app/controllers/users_controller.rb
best_in_place-3.1.0 spec/internal/app/controllers/users_controller.rb
best_in_place-3.0.3 spec/internal/app/controllers/users_controller.rb
best_in_place-3.0.2 spec/internal/app/controllers/users_controller.rb
best_in_place-3.0.1 spec/internal/app/controllers/users_controller.rb