Only allowing areas of site to users using authentication

I have a site in development where I only want specific users to access
specific items that uses belongs_to and has_many.

Say we have this kind of structure.

Person <belongs_to + has_many> Items

When person logged in they only have access to items that belongs to

I’m using auth_generator but only seem to put an auth inside controllers
and dont know how to go any futher.

Any help would be great.

To further ellaborate…

This is my table structure

Client (has many domains)
Domain (belongs to client and has many reports)
Report (belongs to domain)

Currently when I select client in the frontend it shows me what domains
belong to that client. I want to set up that when a client logs in it
shows the domains/reports that belong to them.


Hi, Guest,

I think your problem isn’t solely about authentication. IMHO you simply
the following steps:

#1: Check if there is a user authenticated => if not display the login
or a guest page or whatever
#2: Read the session to get the user who is authenticated => don’t know
to do this with auth_generator but probably it’s something like
#3: use the relation from the read out user with something like:
#4: Display the resulting items

Best Regards
Jan P.

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