# How should I use Login Engine for these things:

**URL:** <https://www.ruby-forum.com/t/how-should-i-use-login-engine-for-these-things/93938>\
**Category:** Engines\
**Created:** [April 15, 2006, 9:34am UTC](https://www.ruby-forum.com/t/how-should-i-use-login-engine-for-these-things/93938 "2006-04-15T09:34:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adambeazley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/5f9b8f/32.png) [@adambeazley](https://www.ruby-forum.com/u/adambeazley)\
**Post date:** [April 15, 2006, 9:34am UTC](https://www.ruby-forum.com/t/how-should-i-use-login-engine-for-these-things/93938/1 "2006-04-15T09:34:23Z")

</div>

Here are a few things I want to do:

Assign objects of the model “show” to users when they’re created and  
allow the user to view only their own shows.

What I have right now consists of show.user = session[:user] on  
creation. This works fine. But when I go back to view my shows the new  
show doesn’t show up on the list. Only if I logout and log back in does  
it show up. This is the “list” action in the controller:

@user = session[:user]  
@shows = @user.shows

I notice when you log in, session[:user] is saved to the database. Could  
that be the problem? How do I work around it?

I also want to add a user type “admin.” This is a super-user type who is  
the only one who can edit and destroy anyone’s listings. Is it as simple  
as setting role to “admin” for certain users and putting:

unless @user.role == “admin”  
#redirect and such  
end

in certain parts of my controller?

Thanks in advance,

Adam
