On 10 Nov 2008, at 23:23, giorgio wrote:
> > Thanks for the reply Fred. > But that just creates a new question.. How do I ensure that my patch > file is loaded after the plugin? > stuff in config/initializers should be loaded after plugins. Fred > G. > > On Nov 11, 11:44 am, Frederick Cheung <[EMAIL PROTECTED]> > wrote: >> On 10 Nov 2008, at 22:39, giorgio wrote: >> >> >> >> >> >>> Hi, >> >>> I am having trouble overriding methods in a plugin. >>> I am trying to apply a patch to attachment_fu by overriding a method >>> in on of the attachment_fu modules from with a file in my libs >>> folder. >> >>> I am using the suggestions >>> fromhttp://epirsch.blogspot.com/2008/01/fixing-attachmentfu-on-windows-li >>> ... >> >>> If I paste the change directly into the atachment fu module the fix >>> works. However if I try to make the fix from within my >>> attachment_fu_patch.rb it doesn't work and ruby appears to be still >>> calling the original method. >> >>> This makes me ask the question: If you re-open modules and /or >>> classes >>> multiple times and override methods, how does ruby know which one is >>> the "latest". ie how can I ensure that my override is the one that >>> is >>> called? >> >> Chronological order of file loading, pure and simple. if files >> overide_a and overide_b both define the same method on the same >> class, >> then if ruby loads a first then the final method definition will be >> the one in b (and vice versa). Ruby isn't doing any clever tracking >> of >> anything - stuff just gets overwritten >> >> Fred > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

