0
У меня есть эти модели:Несколько has_manys той же модели
Person
has_many :messages_form_person, :foreign_key => :from_user_id, :class_name => :messages
has_many :messages_to_person, :foreign_key => :to_user_id, :class_name => :messages
Сообщение
belongs_to :to_person, :foreign_key => :to_user_id, :class_name => :person
belongs_to :from_person, :foreign_key => :to_user_id, :class_name => :person
И это мнение:
человек # показать
<% @person.messages_to_person.each do |message| %>
<%=h message.title %>
<% end %>
Но я получаю эту ошибку:
TypeError in People#show
Showing app/views/people/show.html.erb where line #26 raised:
can't convert Symbol into String
Extracted source (around line #26):
23: <%=h @person.biography %> 24: </p> 25: 26: <% @person.messages_to_person.each do |message| %> 27: 28: <% end %> 29:
Я в принципе хочу это так, чтобы люди могли посылать друг другу сообщения.
Может ли кто-нибудь мне помочь? Благодарю.
Awesome! Спасибо – 2010-06-18 16:11:36
Добро пожаловать! Вы должны принять ответ:] –
@j. Я ненавижу, что должен подождать 10 минут, прежде чем я смогу принять ответ. – 2010-06-19 12:42:03