Had a similar problem a while ago, this helped me sort it out: http://www.thirdbit.net/articles/2007/08/01/10-things-you-should-know-about-method_missing/
Basically you have to catch it after acriverecord is done with it. BTW we decided not to use method_missing in any modules to avoid spurious interractions --------------------------------- John Jones UK: (+44) (0)797 644-3043 "Ideas are like rabbits. You get a couple and learn how to handle them, and pretty soon you have a dozen." John Steinbeck On Tue, May 19, 2009 at 10:39 AM, Francis Fish <[email protected]> wrote: > Hi guys > > Running 2.2.2. > > Background: > > We've created some method missing stuff in one of our active record models > that allows you to do things like > > claim.offer_progress_received > > This will find or create a progress called offer and set its received date. > Very happy with this because it makes what the code is doing explicit. > > Now, the odd bit: > > If I access the claim from a child record, e.g. our document class > > document.claim.offer_progress_received > > It blows with a method missing. It looks like the method_missing in the > class is being overridden when you walk up the belongs_to relationship. > > I have temporarily hacked around this by doing this > > _claim = Claim.find(document.claim_id) > > And then _claim will work as advertised. > > Any ideas how to de hack this? I don't like having magic spells in the code. > > Thanks and regards, > > Francis > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "NWRUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nwrug-members?hl=en -~----------~----~----~----~------~----~------~--~---
