Sha256: c9f755611dc5376eec66df0fb27fc276ab8878ff9ff2e0cba50fc9b9de683357
Contents?: true
Size: 1.13 KB
Versions: 4
Compression:
Stored size: 1.13 KB
Contents
class CommonDocumentsController < InheritedResources::Base belongs_to_subjects :optional => true before_filter :subject!, :only => :index load_and_authorize_resource :except => :index def show path = resource.file.path(params[:style]) respond_to do |format| format.all { send_file path, :filename => resource.file_file_name, :type => resource.file_content_type, :disposition => "inline" } end end def destroy @post_activity = resource.post_activity destroy! end private def subject @subject ||= association_chain[-1] || current_subject end def subject! @subject ||= association_chain[-1] || warden.authenticate!(:user) end def collection @activities = 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
4 entries across 4 versions & 1 rubygems