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-0.30.2 base/app/controllers/profiles_controller.rb
social_stream-base-0.24.2 app/controllers/profiles_controller.rb
social_stream-0.30.1 base/app/controllers/profiles_controller.rb
social_stream-base-0.24.1 app/controllers/profiles_controller.rb
social_stream-0.30.0 base/app/controllers/profiles_controller.rb
social_stream-base-0.24.0 app/controllers/profiles_controller.rb
social_stream-0.29.0 base/app/controllers/profiles_controller.rb
social_stream-base-0.23.0 app/controllers/profiles_controller.rb
social_stream-0.28.4 base/app/controllers/profiles_controller.rb
social_stream-base-0.22.4 app/controllers/profiles_controller.rb
social_stream-0.28.1 base/app/controllers/profiles_controller.rb
social_stream-base-0.22.1 app/controllers/profiles_controller.rb
social_stream-0.28.0 base/app/controllers/profiles_controller.rb
social_stream-base-0.22.0 app/controllers/profiles_controller.rb
social_stream-0.27.3 base/app/controllers/profiles_controller.rb
social_stream-0.27.2 base/app/controllers/profiles_controller.rb
social_stream-base-0.21.2 app/controllers/profiles_controller.rb
social_stream-0.27.1 base/app/controllers/profiles_controller.rb
social_stream-base-0.21.1 app/controllers/profiles_controller.rb
social_stream-0.27.0 base/app/controllers/profiles_controller.rb