我正在尝试在对话路径中组合集合和成员。但我无法理解,
squid_prestart()
{
# prepare the state directory:
[ -d ${state_dir} ] && rm -rf ${state_dir}
install -d -o ${squid_user} -m 0755 ${state_dir}
# setup KRB5_KTNAME:
KRB5RCACHETYPE=none export KRB5RCACHETYPE
squid_krb5_ktname=${squid_krb5_ktname:-"NONE"}
if [ "${squid_krb5_ktname}" != "NONE" ]; then
export KRB5_KTNAME=${squid_krb5_ktname}
fi
# setup FIB tables:
if command -v check_namevarlist > /dev/null 2>&1; then
check_namevarlist fib && return 0
fi
${SYSCTL} net.fibs >/dev/null 2>&1 || return 0
squid_fib=${squid_fib:-"NONE"}
if [ "${squid_fib}" != "NONE" ]; then
command="setfib -F $squid_fib $command"
else
return 0
fi
}
和
resources :conversations, only: [:index, :show, :destroy] do
member do
post :reply
post :restore
end
end
当我将它们组合起来时它不起作用,显然这个也是错误的!
答案 0 :(得分:1)
在member
块中合并collection
和resources
。像这样,
resources :conversations, only: [:index, :show, :destroy] do
member do
post :reply
post :restore
end
collection do
delete :empty_trash
end
end
或者你也可以这样组合,
resources :conversations, only: [:index, :show, :destroy] do
post :reply, on: :member
post :restore, on: :member
delete :empty_trash, on: :collection
end
答案 1 :(得分:0)
试试这个
resources :conversations, only: [:index, :show, :destroy] do
member {
post :reply
post :restore
}
collection {
delete :empty_trash
}
end