2013.08.06 Railsã§before_filter/before_actionãã¢ã¯ã·ã§ã³ãä¸æ¢ããä»çµã¿ãèªãã§ã¿ã 大æã®Railsã§ã¯ãbefore_filterã§falseãè¿ãã¨ããã§chainãçµãããã¨ãã£ã¦ããæ°ããã¾ãããä»ã¯ããããã³ã¼ãè¦ãªãã§ãããã Rails 4ã ã¨ãããªããªã§before_actionã§redirectã㦠ã¯ãããã¾ããã£ã¦ããã¾ãããã class UsersController < ApplicationController before_action :my_authenticate_admin def my_authenticate_admin unless current_user.admin? redirect_to root_path end end end å½ç¶ã以å¾ã®before_actionãactionã¯å®è¡ã
{{#tags}}- {{label}}
{{/tags}}