Google Groups Home
Help | Sign in
Message from discussion ActiveRecord::HasManyThroughCa ntAssociateNewRecords (Cannot associate new records through 'Page#imageables' on '#'. Both records must have an id in order to create the has_many :through record associating them.)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Sean Schofield  
View profile
 More options May 14, 5:10 pm
From: Sean Schofield <sean.schofi...@gmail.com>
Date: Wed, 14 May 2008 14:10:26 -0700 (PDT)
Local: Wed, May 14 2008 5:10 pm
Subject: Re: ActiveRecord::HasManyThroughCantAssociat eNewRecords (Cannot associate new records through 'Page#imageables' on '#'. Both records must have an id in order to create the has_many :through record associating them.)
FYI.  I was running into the same problem using has_many_polymorphs
and this solution also worked for me as well.

Sean

On Apr 23, 6:41 pm, Bartek <grinkiew...@gmail.com> wrote:

> I forgot about "object_params", here is the correction:

>   create.after do
>     @page.images << @image if parent_type == :page
>   end

>   private

>   def build_object
>     @object ||= Image.new object_params
>   end


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google