Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
belongs_to with :class_name option
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ryan Kinderman  
View profile  
 More options Nov 16 2007, 9:12 pm
From: Ryan Kinderman <r...@kinderman.net>
Date: Fri, 16 Nov 2007 18:12:25 -0800 (PST)
Local: Fri, Nov 16 2007 9:12 pm
Subject: belongs_to with :class_name option
The code does not properly determine the primary_key_name value from
the association reflection when a 'belongs_to' association is
specified with the :class_name option.  Example from the patch I've
submitted:

class Reading < ActiveRecord::Base
  belongs_to :article
  belongs_to :reader, :class_name => "User"
end

Failing test:

def test_belongs_to_with_class_name
  @reading = Reading.find(:first)
  assert_not_nil @reading.reader
end

The value of AssociationReflection#primary_key_name in this case will
be "user_id" instead of "reader_id", as it should be.

Patch file:
http://compositekeys.googlegroups.com/web/belongs_to_with_class_name....


    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.
Ryan Kinderman  
View profile  
 More options Nov 21 2007, 9:37 pm
From: Ryan Kinderman <r...@kinderman.net>
Date: Wed, 21 Nov 2007 18:37:56 -0800 (PST)
Local: Wed, Nov 21 2007 9:37 pm
Subject: [PATCH] belongs_to with :class_name option
For clarity...

On Nov 16, 8:12 pm, Ryan Kinderman <r...@kinderman.net> wrote:


    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.
End of messages
« Back to Discussions « Newer topic     Older topic »

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