例如,如果我编写了一个弹出组件,现在我想在另一个组件中使用它,在这种情况下,当我触发错误的操作时,它将在同一个视图中被动态触发和加载。但现在我找不到处理它的好方法。
答案 0 :(得分:0)
您可以使用# config/initializers/acu_rules.rb
Acu::Rules.define do
# anyone makes a request could be count as everyone!
whois :everyone { true }
whois :admin, args: [:user] { |c| c and c.user_type == :ADMIN.to_s }
whois :client, args: [:user] { |c| c and c.user_type == :CLIENT.to_s }
# any request that doesn't match with a rule will be denied by default;
# but this can be configured to not to!
# the default namespace
namespace do
controller :home, except: [:some_secret_action] do
allow :everyone
end
controller :home do
allow [:admin, :client], on: [:some_secret_action]
end
end
# the admin namespace
namespace :admin do
allow :admin
controller :contact, only: [:send_message] do
allow :everyone
end
controller :contact do
action :support {
allow :client
}
end
end
end
在视图中呈现任何自定义组件。