Skip to content

Instantly share code, notes, and snippets.

@hisaichi5518
Created December 22, 2014 09:11
Show Gist options
  • Save hisaichi5518/114535f1206d31c62b83 to your computer and use it in GitHub Desktop.
Save hisaichi5518/114535f1206d31c62b83 to your computer and use it in GitHub Desktop.
簡単にレエイルズのfilterの確認がしたい
require "text-table"
module AbstractController
module Callbacks
def process_action(*args)
run_callbacks(:process_action) do
super
end
table = Text::Table.new
table.head = ["callback_name", "kind"]
_process_action_callbacks.each do |v|
_if = self.instance_eval(v.instance_variable_get(:@if).join("&&"))
if !_if.nil? && !_if
next
end
table.rows << [v.filter, v.instance_variable_get(:@kind)]
end
puts table.to_s
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment