I have this:
class Document < ActiveRecord::Base
belongs_to :documentable, :polymorphic => true
class Task < ActiveRecord::Base
has_many :documents, :as => :documentable
This, on Document, doesn't work:
undefined method `find_all_by_documentable' for Document:Class
I've spent hours googling on polymorphism and find, and everyone just
talks about how it just works. Only it doesn't because find_all_by
isn't defined for my polymorphic association. I guess I could do
.find("documentable_type = ?, documentable_id = ?"...
but that just seems really crude. Any advice?