I have been working on a polymorphic STI schema where the inheriting
classes have associations:

class Asset < ActiveRecord::Base
end

class Sound < Asset
  belongs_to :user, :polymorphic => true
end

class User < ActiveRecord::Base
  has_many :sounds
end

The Asset class contains a 'type' attribute which is getting properly
populated with the inheriting class's name, so that's fine, but I was
getting an error that there was no 'user_type':

undefined method `user_type' for #<Sound:0x4cf3740>

OK, so I added 'user_type' to the Asset model and I can get past that
error (which was only raised upon a :destroy for the object). However,
now that I've added it, the user_type is not being populated when new
objects are created/saved. Am I missing something?

-eric
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to