getting the results of another person in the same controller

please tell me how to get the information of one user by the
another with in the same controller? is it possible? please tell me the
solution with some example ?
and also tell me how to get the related information when the user using
the select list?

sir,
i have two control panels one for mentor and another for student and i
have also one course controller with course table
here mentor create the courses?

my task is student can select the courses which are created by the
mentor?
here the mentor and the student are the separate users?

please tell me how to get the mentor courses by the student?

give me the solution with some code

Thanks,

please tell me how to get the information of one user by the
another with in the same controller? is it possible? please tell me the
solution with some example ?

@other_user = User.where( some conditions )

and also tell me how to get the related information when the user using
the select list?

Sorry, I have not idea what is meant by this question.

Colin

Hi Kapil,

I’m not sure if I understand you correctly but if you’re trying to pull information created by another user, you should store whatever data you want to extract into a database first and then subsequently pull it with your other user.

So for example,

Mentor model

Mentor has_many courses
Mentor has_many users

User model

User belongs_to mentor

Course model

Course belong_to mentor

And all you have to do is get

@user (being your current user object)

@user.mentor.courses

Cheers,
David
@davidchua