Forum: Rails Engines How should I use Login Engine for these things:

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
6ec1e89eef5ce09fbfa56be5b6dd17b5?d=identicon&s=25 Adam Bloom (admanb)
on 2006-04-15 09:34
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

in certain parts of my controller?

Thanks in advance,

This topic is locked and can not be replied to.