I just got the Rails Recipies and I''m looking the Recipe 17. class Person < ActiveRecord::Base has_many :addresses, :as => :addressable end class Company < ActiveRecord::Base has_many :addresses, :as => :addressable end class Address < ActiveRecord::Base belongs_to :addressable, :polymorphic => true end At the beggining I had some problems because "polymorphic" was not supported on Rails1.0.0 then I update rails. In the console everything works fine but when I''m trying to list the people I''m getting the "Unknown key(s): as" error. Does anyone have a clue of what''s going on? ------------------------------------------- This is what I have updated C:\rails>gem update rails --source http://gems.rubyonrails.org Upgrading installed gems... Updating Gem source index for: http://gems.rubyonrails.org Attempting remote upgrade of rails Attempting remote installation of ''rails'' Install required dependency activesupport? [Yn] y Install required dependency activerecord? [Yn] y Install required dependency actionpack? [Yn] y Install required dependency actionmailer? [Yn] y Install required dependency actionwebservice? [Yn] y Successfully installed rails-1.0.0.4008 Successfully installed activesupport-1.2.5.4008 Successfully installed activerecord-1.13.2.4008 Successfully installed actionpack-1.11.2.4008 Successfully installed actionmailer-1.1.5.4008 Successfully installed actionwebservice-1.0.0.4008 Installing RDoc documentation for activesupport-1.2.5.4008... Installing RDoc documentation for activerecord-1.13.2.4008... Installing RDoc documentation for actionpack-1.11.2.4008... Installing RDoc documentation for actionmailer-1.1.5.4008... Installing RDoc documentation for actionwebservice-1.0.0.4008... Gems: [rails] updated C:\rails>rails -v Rails 1.0.0 -- Posted via http://www.ruby-forum.com/.
Runar Ingebrigtsen
2006-Mar-23 13:47 UTC
[Rails] BROKEN has_many :addresses, :as => :addressable
tor, 23,.03.2006 kl. 00.24 +0100, skrev Rath:> class Person < ActiveRecord::Base > has_many :addresses, :as => :addressable > end > > class Company < ActiveRecord::Base > has_many :addresses, :as => :addressable > end > > class Address < ActiveRecord::Base > belongs_to :addressable, :polymorphic => true > endSeems broken. I get:>> Company.find(1).create_addressNoMethodError: undefined method `create_address'' It''s working great if i''m using: has_one :address, :as => :addressable -- Runar Ingebrigtsen <runar@mopo.no> mopo as -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 191 bytes Desc: Dette er en digitalt signert meldingsdel Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060323/a76236ac/attachment.bin