Hi Jan,
Ich vermute mal dass alias_method erst dann Sinn macht wenn das Module
inkludiert wird. Ohne testen, aber es sollte etwa in diese Richtung
gehen.
module AliastestHelper
def included
alias_method :orig_validate, :validate
end
...
end
ciao, tom
Am 01.05.2008 um 22:03 schrieb Jan Luehr:
ja hallo erstmal,..
ich stehe hier vor einem kleinen Problem.
Ich möchte gerne gemeinsam genutzte Validierungsroutinen in einen
helper
auslagern und dann includieren. Der helper sieht so aus:
module AliastestHelper
alias_method :orig_validate, :validate
def validate
errors.add_to_base("Helper included")
orig_validate
end
end
Wenn ich ihn einbinden, wird folgende Exception geworfen:
undefined method `validate' for module `AliastestHelper'
--
Thomas R. "TomK32" Koll || http://tomk32.de || http://ananasblau.com
just a geek trying to change the world
Skype: TomK32 || Mail: [EMAIL PROTECTED]
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug