Sha256: 297239eb3159644cf7a3588e7def4fe9d440aafcffbe3581896b3f1f954b0998

Contents?: true

Size: 721 Bytes

Versions: 25

Compression:

Stored size: 721 Bytes

Contents

class ProfilesController < ApplicationController
  before_filter :authenticate_user!, :except => [ :show ]

  respond_to :html, :js

  def show
    subject_profile
  end

  def edit
    current_profile
  end

  def update
    current_profile.update_attributes params[:profile]

    respond_to do |format|
      format.html{ redirect_to [profile_subject, :profile] }
      format.js
    end
  end

  private

  def subject_profile
    @profile ||=
      profile_subject!.profile
  end

  def current_profile
    @profile ||= find_current_profile
  end

  def find_current_profile
    unless profile_subject!.represented_by?(current_subject) 
      raise CanCan::AccessDenied
    end

    current_subject.profile
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
social_stream-base-0.21.0 app/controllers/profiles_controller.rb
social_stream-0.26.2 base/app/controllers/profiles_controller.rb
social_stream-base-0.20.2 app/controllers/profiles_controller.rb
social_stream-0.26.1 base/app/controllers/profiles_controller.rb
social_stream-base-0.20.1 app/controllers/profiles_controller.rb