This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

accidentily deleted

git-svn-id: https://svn.thoughtbot.com/plugins/when/trunk@325 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information...
1 parent 6751bed commit 461ec952c2638b1c731f69d1421904745c31ae20 jcarroll committed Feb 13, 2008
Showing with 11 additions and 2 deletions.
  1. +4 −2 lib/callbacks.rb
  2. +7 −0 lib/when.rb
View
@@ -9,8 +9,11 @@ class << klass
callbacks.each do |callback|
src = <<-END
- def #{callback}_with_conditions(*callbacks)
+ def #{callback}_with_conditions (*callbacks, &block)
options = callbacks.extract_options!
+ if block_given?
+ callbacks << block
+ end
callbacks.each do |callback|
#{callback}_without_conditions do |record|
unless (! options[:if].nil? && ! evaluate_condition(options[:if], record)) ||
@@ -22,7 +25,6 @@ def #{callback}_with_conditions(*callbacks)
end
alias_method_chain :#{callback}, :conditions
END
-
class_eval src, __FILE__, __LINE__
end
end
View
@@ -3,3 +3,10 @@
ActiveRecord::Base.send :include, ActiveRecordHook::Callbacks
ActionController::Base.send :include, ActionControllerHook::Filters
+
+# module When
+
+# def
+# end
+
+# end

0 comments on commit 461ec95

Please sign in to comment.