0
那麼,我是ROR的新手。 我需要重定向用戶到某個頁面,這個運行但沒有工作。 總是重定向到鏈接4,對於其他選項,我檢查數據庫,並且用戶有一個角色: 錯誤在哪裏?謝謝!如何通過角色重定向用戶?
module ApplicationHelper
def role_link(user)
user = User.find(1)
case user.rol
when 'A'
url = 'link 1'
when 'C'
url = 'link 2'
when 'E'
url = 'link 3'
else
url = 'link 4'
end
end
你嘗試任何測試? – MageeWorld
我能做什麼?你有什麼建議? Magee –
您可能在您的病例陳述結束時錯過了_e_? 'case user.role' –