Sha256: 186a26d37ec238344e4d1b284069f002ea8ccbbda536f9c3b58ab3955f3fdbde

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

class CommonDocumentsController < InheritedResources::Base
  respond_to :html, :js

  belongs_to_subjects :optional => true

  before_filter :profile_subject!, :only => :index

  load_and_authorize_resource :except => :index


  def show
    respond_to do |format|
      format.html {render :action => :show}
      format.all {
        path = resource.file.path(params[:style] || params[:format])

        send_file path, 
                  :filename => resource.file_file_name,
                  :disposition => "inline"
      }
    end
  end
  
  def destroy
    @post_activity = resource.post_activity
    
    destroy!
  end

  private

  def collection
    @activities = profile_subject.wall(:profile,
                                       :for => current_subject,
                                       :object_type => Array(self.class.index_object_type)).
                                  page(params[:page]).
                                  per(params[:per])
  end

  class << self
    def index_object_type
      controller_name.classify
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
social_stream-0.12.0 documents/app/controllers/common_documents_controller.rb
social_stream-documents-0.4.0 app/controllers/common_documents_controller.rb