Re: desperate, errors with file upload

PeterI
Thu, 02 Jun 2011 14:05:59 -0000

hi, thanks a lot for your answer!

the application is very simple. user registration with authlogic and
file upload. [1] shows the FileUploadController. Authlogic creates a
session object. a before filter looks if the user is logged in. [2]
shows the UserSessionController.

I dont think its authlogic that dumps the file into the session,
because i got the error since i tryed to implement a file upload
(before i added user registration), and i got the same error from
attachment_fu plugin. by the way the application is hosted on
github:https://github.com/peonic/ichsehichseh
is there a way to disable session store for a Controller.
thx


[1]
class UploadItemController < ApplicationController
  before_filter :require_user

  def new
    @user = current_user
    @upload_item = UploadItem.new()
    @story = @user.story.first
  end

  def create
    @upload_item = UploadItem.new(params[:upload_item])
    @upload_item.story = current_user.story.first

    if @upload_item.save
      flash[:notice] = "Upload completed"
      redirect_to user_url(current_user)
    else
      flash[:error] = @upload_item.errors
      render :action => new
    end
  end
end

[2]
class UserSessionsController < ApplicationController
  before_filter :require_no_user, :only => [:new, :create]
  before_filter :require_user, :only => :destroy

  def new
    @user_session = UserSession.new
  end

  def create
    @user_session = UserSession.new(params[:user_session])
    if @user_session.save
      flash[:notice] = "Erfolgreich Eingeloggt"
      redirect_to user_url(@user_session)
    else
      render :action => :new
    end
  end

  def destroy
    current_user_session.destroy
    redirect_to new_user_session_url
  end