Displaying 1 result from an estimated 1 matches for "fk_line_msg_rooms".
2006 Jul 13
1
model navigation problem with foreign key
...his
def self.up
create_table :line_msgs do |t|
t.column :sender_nick, :string
t.column :content, :string
t.column :room_id, :integer, :null => false
t.column :send_at, :timestamp
end
execute "alter table line_msgs
add constraint fk_line_msg_rooms
foreign key (room_id) references ac_rooms(id)"
end
and i added the belongs_to :ac_room in line_msg.rb and has_many:
:line_msgs to ac_room.rb in the model, but when i did
room = AcRoom.find(...)
<%= render(:partial => "line_msg", :collection => room...