how to add a method without coding it directly into app?

Bluebie, Jenna blueberry at creativepony.com
Thu Jun 5 04:21:24 EDT 2008


Change Blog::Controllers to Camping::Controllers and require it before  
Caming.goes :somewhere_else


On 05/06/2008, at 6:19 PM, ronald.evangelista wrote:

> i'm missing something here.
> how would I code this outside the application to be shared with  
> other Camping apps?
>
> module Blog::Controllers
>   module AuthenticationHelper
>       def self.included(base)
>           class << base
>               define_method :authenticate do |*a|
>                   a.each do |meth|
>                       if method_defined?(meth.to_s)
>                           alias_method "__#{meth}__", meth
>                           class_def(meth) do |*a|
>                               @state.Back=@env.REQUEST_URI
>                               return redirect(Login) if  
> @state.blank? or @state.user_id.nil?
>                               send("__#{meth}__", *a)
>                           end
>                       end
>                   end
>               end
>           end
>       end
>   end
> end
>
> any hints? thanks!
> _______________________________________________
> Camping-list mailing list
> Camping-list at rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list



More information about the Camping-list mailing list