Sha256: 28609ceb185df38afaa3ff5f1475905e031b5d7824def98ccf00801286afa1ff

Contents?: true

Size: 461 Bytes

Versions: 2

Compression:

Stored size: 461 Bytes

Contents

class AvatarsController < ApplicationController
  before_filter :assign_user
  
  def show
  end
  
  def update
    if @user.update_attributes(params[:user])
      if params[:user][:avatar].blank?
        redirect_to avatar_url
      else
        redirect_to crop_avatar_url
      end
    else
      flash.now.alert = "Invalid image format"
      render :show
    end
  end
  
  def crop
  end
  
private
  
  def assign_user
    @user = current_user
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
buddies_avatar-0.0.2 app/controllers/avatars_controller.rb
buddies_avatar-0.0.1 app/controllers/avatars_controller.rb