Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Filter
- module ClassMethods
- def before_filter(sym, *only)
- only.each do |method|
- module_eval <<-END
- def #{method}_with_before_filter(*args, &block)
- send :#{sym}
- send :#{method}_without_before_filter, *args, &block
- end
- alias_method :"#{method}_without_before_filter", :#{method}
- alias_method :#{method}, :"#{method}_with_before_filter"
- END
- end
- end
- end
- def self.included(mod)
- mod.send :extend, ClassMethods
- end
- end
Add Comment
Please, Sign In to add comment