Hallo, I am having a very strange Problem with STI in my application. setup: - two tables one called "wikis" on called "categories" with a hbtm relationship. - the wikis table is the sti one with a model PageWiki being extended from Wiki (and the correspondig type column) Following happens: - server restart - get :wikis, :show_pages - in show_pages the first line says PageWiki.find(:all) ! Now I get the following error LoadError in WikisController#list_pages app/models/page_wiki.rb to define PageWiki // (it is of course defined there ) If i call the page again everythings works as it should be and the the error message never appears again until the server restarts BUT ! When I now try to add categories to my wikis with @wiki = Wiki.find(params[:wiki]) @category = Category.find(params[:id]) @wiki.categories << @category unless @wiki.categories.index(@category) I get the VERY unhelpful error messages telling me ActiveRecord::AssociationTypeMismatch in WikisController#add_category Category expected, got Category This error does not appear if do not call the list_pages method before. If I change the line PageWiki.find(:all) to Wiki.find(:all, :conditions =>"type='PageWiki'") it all works. Does anybody have any ideas what happens here? Thanks a lot for any help. migo
on 2007-07-22 14:40
on 2007-07-23 09:59
I have to correct myself here. Although things work (dont work) in the order described the Category expected, got Category Error message still appears after a while and then continues to be there until a server restart. Now this is really a problem! A bit of googling revealed that is has to do with the plugins used. So these are the plugins used: acts_as_versioned acts_as_tree globalize Any idea ?