I''m using MessageBoard (child) to acts_as_list for Forum
(parent). The models looks as such:
-----------------------------
class Forum < ActiveRecord::Base
#This is a superset of message boards
has_many :message_boards, :order => :order, :dependent => :destroy
...
end
-----------------------------
class MessageBoard < ActiveRecord::Base
#This is a subset of forums
belongs_to :forum
#This causes MessageBoard to act as a list
#it uses order as its index
acts_as_list :scope => :forum_id
...
end
-----------------------------
A slight mistake on my part, I wanted the message boards to be ordered
by the MySQL (I use Rails 1.2.5) column :order (as seen in line :order
=> :order). However, this error arises:
-----------------------------
Loaded suite message_board_test
Started
........E.
Finished in 0.347567 seconds.
1) Error:
test_title_overlap(MessageBoardTest):
ActiveRecord::StatementInvalid: Mysql::Error: #42S22Unknown column
''position'' in ''order clause'': SELECT * FROM
message_boards WHERE
(forum_id = 2) ORDER BY position DESC LIMIT 1
....
-----------------------------
Does the indexed column name HAVE to be "position"?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---