Sha256: c087ba0bbd1f170e150e10908935b47e2b1a51da3dcda7154b36d30e739da138

Contents?: true

Size: 804 Bytes

Versions: 5

Compression:

Stored size: 804 Bytes

Contents

class Wco::ProfilesController < Wco::ApplicationController

  def edit
    @profile = Wco::Profile.find params[:id]
    authorize! :update, @profile
  end

  def index
    @profiles = Wco::Profile.all
    authorize! :index, Wco::Profile
  end

  def update
    @profile = Wco::Profile.find params[:id]
    authorize! :update, @profile

    # if params[:photo]
    #   photo = Photo.new :photo => params[:photo]
    #   @profile.profile_photo = photo
    # end

    flag = @profile.update params[:profile].permit!
    if flag
      flash_notice "Updated profile #{@profile.email}"
    else
      flash_alert "Cannot update profile: #{@profile.errors.full_messages}"
    end
    if params[:redirect_to]
      redirect_to params[:redirect_to]
    else
      redirect_to request.referrer
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wco_models-3.1.0.152 app/controllers/wco/profiles_controller.rb
wco_models-3.1.0.151 app/controllers/wco/profiles_controller.rb
wco_models-3.1.0.150 app/controllers/wco/profiles_controller.rb
wco_models-3.1.0.149 app/controllers/wco/profiles_controller.rb
wco_models-3.1.0.148 app/controllers/wco/profiles_controller.rb