Received: by 10.35.70.2 with SMTP id x2mr473297pyk; Sun, 20 Aug 2006 14:47:38 -0700 (PDT) Received: from 24.118.117.246 by i42g2000cwa.googlegroups.com with HTTP; Sun, 20 Aug 2006 21:47:37 +0000 (UTC) From: "Paul Corcoran" To: "Ruby on Rails: Talk" Subject: Problem with overriding rails accessor methods Date: Sun, 20 Aug 2006 14:47:37 -0700 Message-ID: <1156110457.453870.250500@i42g2000cwa.googlegroups.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6,gzip(gfe),gzip(gfe) MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Hello all, I just encountered something that is not what I would expect. I overrode an accessor method in my model class and within this method I did a "super" call which failed. Of couse my real method would be doing more but here is the basic code that shows the problem: class Word < ActiveRecord::Base belongs_to :verse belongs_to :grammar_tense_code def grammar_tense_code obj = super end end In my view I call: <%= word.grammar_tense_code.descr %> The error message I get is: "super: no superclass method `grammar_tense_code'". I realize there is no real 'grammar_tense_code' method and that rails handles this for me. BUT, I would have expected the message to be passed up the chain and handled by Rails active record code which would read the database. This is typical oo behavior. Does anybody know what is happening here and how to work around it? (Incidentally, if I remove this method everything works fine. Rails retrieves the object from the database and gives me it's "descr" attribute.) Thanks in advance, Paul