Sha256: 0bfe366c95e6f5edb24723d6b621691b78a5dd4e6f2a96c84e19d6d797776060

Contents?: true

Size: 800 Bytes

Versions: 4

Compression:

Stored size: 800 Bytes

Contents

class UsersController < ApplicationController
  def index
    @users = User.all
    
    respond_to do |format|
      format.html
      format.json { render :json => User.where("name like ?", "%#{params[:q]}%").map(&:attributes) }
    end
  end

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

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

  def update
    @user = User.find params[:id]
    @user.update_attributes params[:user]
    redirect_to @user
  end

  def new
    @user = User.new
  end

  def create
    @user = User.create params[:user]
    redirect_to @user
  end

  def signin
    @user = User.find params[:id]
    session[:current_user_id] = @user.id if @user
    redirect_to @user
  end

  def signout
    session.delete(:current_user_id)
    redirect_to users_path
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
conversations-0.0.2.2 spec/dummy/app/controllers/users_controller.rb
conversations-0.0.2.1 spec/dummy/app/controllers/users_controller.rb
conversations-0.0.2 spec/dummy/app/controllers/users_controller.rb
conversations-0.0.1 spec/dummy/app/controllers/users_controller.rb