Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated docs

git-svn-id: https://svn.thoughtbot.com/plugins/when/trunk@348 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information...
commit d8487bb35e0f65b57174dd237e439c1ee6c4c937 1 parent f863008
jcarroll authored
Showing with 2 additions and 17 deletions.
  1. +1 −16 README
  2. +1 −1  lib/filters.rb
View
17 README
@@ -94,32 +94,17 @@ before_filter :log_in!,
What When does NOT support
==========================
-# ActiveRecord String callbacks
-before_create 'self.password = password.to_sha1',
- :unless => lambda {|user| user.password_confirmation.blank?}
-
# ActiveRecord Class callbacks
before_create PasswordEncryptor,
:unless => lambda {|user| user.password_confirmation.blank?}
-# ActiveRecord Block callbacks
-before_create(:unless => lambda {|user| user.password_confirmation.blank?}) do |record|
- record.password = record.password.to_sha1
-end
-
-# ActionController Block filters
-before_filter(:unless => :logged_in?) do |controller|
- redirect_to new_session_path
-end
-
# ActionController Class filters
before_filter Authorizer,
:unless => :logged_in?
When will not work if your code contains any of these.
-In our experience we've never used any of these types of callbacks and filters. By using Symbols, i.e. methods,
-the resulting code is much more intention revealing. Class callbacks and filters we feel are most of the time overkill.
+In our experience we've never used class callbacks or filters and find them to be overkill.
Installation
============
View
2  lib/filters.rb
@@ -22,7 +22,7 @@ def #{filter}_with_conditions(*filters, &block)
filter.call(controller)
else
raise ActionController::ActionControllerError,
- 'Filters must be a symbol denoting the method to call evaluated or a block to be invoked.'
+ 'Filters must be a symbol denoting the method to call or a block to be invoked.'
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.