Sha256: 5ecb062691f5561f48edf07d043b389258516bf2e8ef662932b7283003fc5c51
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
class DocumentsController < InheritedResources::Base load_and_authorize_resource respond_to :html,:js,:png,:jpeg,:bmp,:gif SEND_FILE_METHOD = :default def show path = @document.file.path(params[:style]) respond_to do |format| format.all {send_file path, :type => @document.file_content_type, :disposition => "inline"} end end def download path = @document.file.path(params[:style]) head(:bad_request) and return unless File.exist?(path) send_file_options = {} case SEND_FILE_METHOD when :apache then send_file_options[:x_sendfile] = true when :nginx then head(:x_accel_redirect => path.gsub(Rails.root, '')) end send_file(path, send_file_options) end def index @subject = User.find_by_slug(params[:user_id]) || Group.find_by_slug(params[:group_id]) #TODO, clarify if use :home or :profile @document_activities = (@subject ? @subject : current_subject).wall(:home, :for => current_subject, :object_type => [:Audio,:Video,:Picture,:Document]).page(params[:page]).per(params[:per]) end def create super do |format| format.all {redirect_to request.referer || home_path} end end def destroy @post_activity = resource.post_activity destroy! end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
social_stream-documents-0.1.6 | app/controllers/documents_controller.rb |