Bonjour,
Je veux mettre en place un système de mise en cache sur mon site en Rails. Dans le cas d'actions demandant une verification des droits de l'utilisateur, je veux avoir recours à caches_action afin que les filtres soient executés.
Voilà mon code :
Code :
- class UsersController < ElementsController
-
- before_filter :login_required
-
- access_control :DEFAULT=>'admin'
-
-
- caches_action :index,
- :show
-
- cache_sweeper :user_sweeper,
- :only => [:create,
- :update,
- :delete]
-
- # GET /users
- # GET /users.xml
- def index
- super
- end
- ....
-
- end
|
Le problème est que je me mange l'erreur suivant quand j'essaie d'accèder à la page en question :
Citation :
NoMethodError (undefined method `[]' for #<Enumerable::Enumerator:0xb7269c08> ):
/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/string/access.rb:53:in `last'
/vendor/rails/actionpack/lib/action_controller/caching.rb:247:in `normalize!'
/vendor/rails/actionpack/lib/action_controller/caching.rb:236:in `path'
/vendor/rails/actionpack/lib/action_controller/caching.rb:195:in `before'
/vendor/rails/actionpack/lib/action_controller/filters.rb:598:in `proxy_before_and_after_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:470:in `call'
/vendor/rails/actionpack/lib/action_controller/filters.rb:470:in `call'
/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
/vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
/vendor/rails/actionpack/lib/action_controller/filters.rb:619:in `perform_action_without_benchmark'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in `perform_action'
/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `send'
/vendor/rails/actionpack/lib/action_controller/base.rb:430:in `process_without_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:624:in `process_without_session_management_support'
/vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process'
/vendor/rails/actionpack/lib/action_controller/base.rb:330:in `process'
/vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch'
/vendor/rails/railties/lib/fcgi_handler.rb:168:in `process_request'
/vendor/rails/railties/lib/fcgi_handler.rb:143:in `process_each_request!'
/vendor/rails/railties/lib/fcgi_handler.rb:109:in `with_signal_handler'
/vendor/rails/railties/lib/fcgi_handler.rb:142:in `process_each_request!'
/usr/lib/ruby/1.8/fcgi.rb:612:in `each_cgi'
/usr/lib/ruby/1.8/fcgi.rb:609:in `each'
/usr/lib/ruby/1.8/fcgi.rb:609:in `each_cgi'
/vendor/rails/railties/lib/fcgi_handler.rb:141:in `process_each_request!'
/vendor/rails/railties/lib/fcgi_handler.rb:55:in `process!'
/vendor/rails/railties/lib/fcgi_handler.rb:25:in `process!'
/var/www/rails/esoxCMS/public/dispatch.fcgi:26
|
Le pire c'est qu'avec caches_page ça marche parfaitement ...
Avez vous une idée?
Merci d'avance
P.S: Le fait que index ne fasse pas grand chose, c'est juste à des fin de debugging..
---------------
Si la vérité est découverte par quelqu'un d'autre,elle perd toujours un peu d'attrait