class Item < ApplicationRecord has_many :pictures, as: :imageable end class Picture < ApplicationRecord belongs_to :imageable, polymorphic: true, optional: true end
NoMethodError in PicturesController#create undefined method `<<' for #<Picture:0x007f3758cc88f0> @item.pictures.create << @picture -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1ad30bf7-4b54-49e7-86ab-8544049e567c%40googlegroups.com.