Received: by 10.35.61.2 with SMTP id o2mr2984310pyk; Mon, 21 Aug 2006 01:46:13 -0700 (PDT) Return-Path: Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.168]) by mx.googlegroups.com with ESMTP id c17si1115444pyc.2006.08.21.01.46.12; Mon, 21 Aug 2006 01:46:13 -0700 (PDT) Received-SPF: pass (googlegroups.com: domain of isak.han...@gmail.com designates 66.249.92.168 as permitted sender) DomainKey-Status: good (test mode) Received: by ug-out-1314.google.com with SMTP id u2so1674620uge for ; Mon, 21 Aug 2006 01:46:12 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=OyQmjb8yK5alwKlE4ZDmlkTNyJFHhFPSwanUsKgfiVEvVXYS2JXbKJqw8pNrp2CcFyvyM0IHAizf4jYjZuw79tVw7aO5WucXiaHVq0gmYNayEIb/P8eaDoHTuwO2/p1VZG8S9h8KBOEMsN8MPyyNRpnuA/ZmdeLTjZXZQmO9Cto= Received: by 10.67.22.2 with SMTP id z2mr3459723ugi; Mon, 21 Aug 2006 01:46:12 -0700 (PDT) Received: by 10.67.87.16 with HTTP; Mon, 21 Aug 2006 01:46:12 -0700 (PDT) Message-ID: <6b9e1eb20608210146m41ab92d6y7587f701f571b6dd@mail.gmail.com> Date: Mon, 21 Aug 2006 10:46:12 +0200 From: "Isak Hansen" To: rubyonrails-talk@googlegroups.com Subject: Re: [Rails] Re: Problem with overriding rails accessor methods In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1156110457.453870.250500@i42g2000cwa.googlegroups.com> <69a2885c0608201513w6e23fda3k3a00649a94313bb0@mail.gmail.com> <1156120958.621193.48010@h48g2000cwc.googlegroups.com> On 8/21/06, Chris Wanstrath wrote: > > belongs_to adds the `grammar_tense_code' method to Word. You're then > (almost immediately) overriding it. To get what you want you need to alias > the original method then reference it inside your new method. > > ar/lib/active_record/associations.rb will lead the way to > wealth and power. > Did he really mean to make a question about associations, though - or just about mapped columns in general? I have to say I find the way AR works quite counter-intuitive. What I'd expect is to have method_missing() implemented in the super class and fully overridable by subclasses, but instead AR:Base decides to fudge with its children. There are probably some sound technical reasons for this, though. I take it there's no viable way for AR::Base.method_missing() to reach/inspect the caller when called (indirectly) from a subclass? Isak