diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-08-04 18:58:18 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-08-04 14:44:34 -0300 |
commit | 84f0a0bc30df58e1edfd09fdde2de891e4577321 (patch) | |
tree | 9ae43e050fa94d61378927d277c9c8d61bc53d00 /actionpack/lib | |
parent | 462666b73717333d460684339c6f6ce07475f713 (diff) | |
download | rails-84f0a0bc30df58e1edfd09fdde2de891e4577321.tar.gz rails-84f0a0bc30df58e1edfd09fdde2de891e4577321.tar.bz2 rails-84f0a0bc30df58e1edfd09fdde2de891e4577321.zip |
Reload action_methods in AbstractController after defining new method.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/abstract_controller/base.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb index 8a8337858b..db0a6736e0 100644 --- a/actionpack/lib/abstract_controller/base.rb +++ b/actionpack/lib/abstract_controller/base.rb @@ -72,6 +72,13 @@ module AbstractController end end + # action_methods are cached and there is sometimes need to refresh + # them. clear_action_methods! allows you to do that, so next time + # you run action_methods, they will be recalculated + def clear_action_methods! + @action_methods = nil + end + # Returns the full controller name, underscored, without the ending Controller. # For instance, MyApp::MyPostsController would return "my_app/my_posts" for # controller_name. @@ -81,6 +88,11 @@ module AbstractController def controller_path @controller_path ||= name.sub(/Controller$/, '').underscore unless anonymous? end + + def method_added(name) + super + clear_action_methods! + end end abstract! |