Sha256: 786f116b94e787acbbaf468a3f22cf9c1b3c8a3e693301c9df2c6ad62cc87d89

Contents?: true

Size: 963 Bytes

Versions: 27

Compression:

Stored size: 963 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 profile_params

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

  private

  def profile_params
    params.
      require(:profile).
      permit(:organization, :birthday, :city, :country, :description, :phone, :mobile, :fax, :address, :website, :experience, actor_attributes: [ :id, :name, :email, :tag_list ])
  end

  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

27 entries across 27 versions & 2 rubygems

Version Path
social_stream-1.1.12 base/app/controllers/profiles_controller.rb
social_stream-base-1.1.11 app/controllers/profiles_controller.rb
social_stream-1.1.11 base/app/controllers/profiles_controller.rb
social_stream-base-1.1.10 app/controllers/profiles_controller.rb
social_stream-1.1.10 base/app/controllers/profiles_controller.rb
social_stream-base-1.1.9 app/controllers/profiles_controller.rb
social_stream-1.1.9 base/app/controllers/profiles_controller.rb
social_stream-base-1.1.8 app/controllers/profiles_controller.rb
social_stream-1.1.8 base/app/controllers/profiles_controller.rb
social_stream-base-1.1.7 app/controllers/profiles_controller.rb
social_stream-1.1.7 base/app/controllers/profiles_controller.rb
social_stream-base-1.1.6 app/controllers/profiles_controller.rb
social_stream-1.1.6 base/app/controllers/profiles_controller.rb
social_stream-base-1.1.5 app/controllers/profiles_controller.rb
social_stream-1.1.5 base/app/controllers/profiles_controller.rb
social_stream-base-1.1.4 app/controllers/profiles_controller.rb
social_stream-1.1.4 base/app/controllers/profiles_controller.rb
social_stream-1.1.3 base/app/controllers/profiles_controller.rb
social_stream-base-1.1.3 app/controllers/profiles_controller.rb
social_stream-1.1.2 base/app/controllers/profiles_controller.rb