【发布时间】:2013-12-03 11:01:55
【问题描述】:
我想在以下控制器的几个特定操作中使用一个名为 :realtor_suscriber 的 before_filter:
realtors/registrations_controller.rb
realtors/sessons_controller.rb
pro/messages_controller.rb
pro/users_controller.rb
我在realtors/registrations_controller.rb中这样定义了realtor_suscriber
def realtor_suscriber!
....my code here...
end
当然,它不适用于其他控制器中的操作(例如 pro/messages_controller.rb)
我不想在 application_controller.rb 中定义 realtor_suscriber 因为我有一些其他控制器他们不需要这个 before_filter 并且我想避免在所有其他控制器中使用 skip_before_filter。
感谢您的提前,
F.
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 before-filter