I have 2 tables... club and forum, which use the "type" as I'm
subclassing the Club and Forum objects. Tables are:
I've put an "after_create" callback in the Club as Club has_one Forum:
class Club < ActiveRecord::Base
# create it (taken from console)
@f = Forum.new(:title => 'Forum', :club_id => self.id)
@f.type = 'Forum'
Now I know this is a bit "longhand", but if I do it from the console
as it is there, I end up with the right data in the table e.g. title,
club_id and type are correct. But if I create it via Club.create, it
doesn't put in the type at all, thus making the application fail.
Success should put a record in the clubs table and a record in the
forums table with the correct type (Club and Forum). What I end up
with is a Club in the clubs table and a default type in the Forum
Very confused. This should be working, and isn't!
Any help would be very much appreciated.