random52k-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Oct-13 18:29 UTC
Edge rails, single table inheritance and keeping multiple classes in a single file
So is the official stance as per edge rails that multiple class definitions must go into separate files? I was trying to use STI with acts_as_attachment, to have all my attachment classes go into a single file, for example: attachment.rb class Attachment < ActiveRecord::Base end class UserPicture < Attachment belongs_to :user, :foreign_key => ''owner_id'' acts_as_attachment ... end but I get the error: superclass mismatch for class UserPicture when using "model :attachment" in my controller.. This used to work under rails 1.1.6. I found the following bug report regarding this problem: http://dev.rubyonrails.org/ticket/5775 Just wondering if this is something that''s going to eventually be fixed, or if from now on, we should start putting all separate classes into individual files? Thanks, Mike --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mike Garey
2006-Nov-04 02:37 UTC
[Rails] Edge rails, single table inheritance and keeping multiple classes in a single file
So is the official stance as per edge rails that multiple class definitions must go into separate files? I was trying to use STI with acts_as_attachment, to have all my attachment classes go into a single file, for example: attachment.rb class Attachment < ActiveRecord::Base end class UserPicture < Attachment belongs_to :user, :foreign_key => ''owner_id'' acts_as_attachment ... end but I get the error: superclass mismatch for class UserPicture when using "model :attachment" in my controller.. This used to work under rails 1.1.6. I found the following bug report regarding this problem: http://dev.rubyonrails.org/ticket/5775 Just wondering if this is something that''s going to eventually be fixed, or if from now on, we should start putting all separate classes into individual files? Thanks, Mike