I have the following four files MODEL class FriendshipRequest < ActiveRecord::Base belongs_to :user belongs_to :requested_by, :class_name => :user, :foreign_key => :requested_by_user_id end MIGRATION create_table :friendship_requests do |t| t.references :user, :null => false t.integer :requested_by_user_id, :null => false t.timestamps end CONTROLLER def index @user = User.find(session[:user]) @friendship_requests = FriendshipRequest.find(:all, session[:user]) end VIEW <% @friendship_requests.each do |friendship_request| -%> <%= friendship_request.requested_by.inspect %> <% end -%> And I am getting the following error: can''t convert Symbol into String Should I not be able to access the user through dot notation using riendship_request.requested_by? What am I doing wrong? Thanks! -- John Kopanas john-Iau1QiYlxLpBDgjK7y7TUQ@public.gmane.org Blog: http://www.kopanas.com Conference: http://www.cusec.net Twits: http://www.twitter.com/kopanas --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
2007/12/26, John Kopanas :> I have the following four files > > MODEL > > > class FriendshipRequest < ActiveRecord::Base > belongs_to :user > belongs_to :requested_by, :class_name => :user, :foreign_key => > :requested_by_user_id > end:class_name => ''User'' -- Jean-François. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
On 26 Dec 2007, at 19:13, John Kopanas wrote:> I have the following four files > > MODEL > > class FriendshipRequest < ActiveRecord::Base > belongs_to :user > belongs_to :requested_by, :class_name => :user, :foreign_key > => :requested_by_user_id > end >:class_name expects a String Fred> Should I not be able to access the user through dot notation using > riendship_request.requested_by? > > What am I doing wrong? > > Thanks! > > -- > John Kopanas > john-Iau1QiYlxLpBDgjK7y7TUQ@public.gmane.org > > Blog: http://www.kopanas.com > Conference: http://www.cusec.net > Twits: http://www.twitter.com/kopanas > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---