AJAX scaffolding session weirdness

All right,

I’m adapting the ajax_scaffolding code.

And I’m am unable to extract the user_id from the session hash.

If if do this:

I inserted some debugging (via ‘raise’) into my article controller, like
this

#-------from my article controller------
def create
begin
@article = Article.new(params[:article])
raise session.inspect
@successful = @railshead_article.save
rescue
flash[:error], @successful = $!.to_s, false
end
#----------------------------------------
I get the following (abbreviated) dump in my flash div:

#, @hash= {“user”=>#“a833626b28fdaadd456d75c7d6f9b55fc2367fec”,
“delete_after”=>nil, “updated_at”=>“2006-08-24 15:41:42”, “role”=>nil,
“firstname”=>“Elliott”, “id”=>“2” … }

Now, it seems that ‘session’ is some hash-like object, but I can’t seem
to access its members:

If I do:

raise session[:user_id]
or
raise session[:user]

I get:
‘exception object expected’

If if do:
raise session[‘user’][‘id’]
‘exception class/object expected’

Or…

raise session.user

yields…

‘undefined method `user’ for #’

Is there a significant gap in my understand that is preventing me from
doing this? It seems like such a basic a operation. I feel very stupid
for not being able to do this. I am trying to repeat examples that I’ve
seen in the books.

I should mention that I’m user saltedpasswordlogin module in combination
with ajax_scaffold generator.

Any help whold be greatly appreciated.

Thanks,
Elliott

On 8/27/06, Elliott B. [email protected] wrote:

this
#----------------------------------------

raise session[:user_id]
or
raise session[:user]

I get:
‘exception object expected’

You can raise only objects inherited from Exception class.


Kent