Skip to content

Instantly share code, notes, and snippets.

@collin
Created June 7, 2009 15:20
Show Gist options
  • Select an option

  • Save collin/125371 to your computer and use it in GitHub Desktop.

Select an option

Save collin/125371 to your computer and use it in GitHub Desktop.
def before_password_verification method_sym, options={}, &block
puts "Called before_password_verification: #{method_sym}, #{options.inspect}"
if block_given?
before :before_password_verification, method_sym, &block
else
before :before_password_verification do
if options[:if]
return false unless send(options[:if])
end
if options[:unless]
return false if send(options[:unless])
end
send method_sym
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment