views:

5

answers:

0

Hi all,

I'm implementing Authlogic and attempting something i haven't done before. I basically have two tables:

  1. account_holder: this has all the standard columns you'd expect...email, crypted_password, etc.

  2. session: this has account_holder_id, persistence_token, last_request_at, last_login_at, etc.

Basically i was hoping to store all session related data in this table as opposed to the accountholder table.

Let's take some code of mine:

def new
  @user = User.new
end

def create
  @user = User.new(params[:user])
  if @user.save_without_session_maintenance
    flash[:notice] = "Account registered!"
    redirect_back_or_default "users#show"
  else
    #render :action => :new
  end
end

What happens when i call @user = User.new(params[:user]) in the Create method is an error message stating that it can't save the persistence token (as i've got the account_holder_id set to NOT_NULL) in that table. My question is, does anyone know why it even wants to do this at that stage? I was under the impression that save_without_session_maintenance was to save the user without creating a persistence token?

Any heads up on how to make this all happen would be great...feel as though i'm banging my head against a wall as i can't find another example of anyone doing something similar on the web.

Thanks.