How should I use Login Engine for these things:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs