Kapil K.
2011-Aug-22 11:47 UTC
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, -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2011-Aug-22 12:27 UTC
Re: getting the results of another person in the same controller
On 22 August 2011 12:47, Kapil K. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
David Chua
2011-Aug-22 23:55 UTC
Re: getting the results of another person in the same controller
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.coursesCheers, David @davidchua On Mon, Aug 22, 2011 at 7:47 PM, Kapil K. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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, > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.