我想在這個控制器中重定向另一個頁面,或因用戶表資訊而發出警告資訊。
但是,我得到了一個如下的錯誤資訊。 像這樣:
class Ir::FactsetUrlsController < Ir::ApplicationController。
def show
user = User.find(params[:user_id])
factset_url, option = get_factset_url(user)
redirect_to factset_url, option
end。
私營
def get_factset_url(投資者)
url, option = if !current_user.factset_enabled?
url, {alert: "A paid subscription is required to view this." }
elsif investor.company.is_fresh?
url, {alert: "我們正在進行錄音。 我們對造成的不便表示歉意,但請耐心等待。" }
elsif investor.company.is_fresh?
url, {alert: "抱歉,我們的投資者資料庫中沒有這個。 2)我們沒有網站或披露的資訊。"}。
else}。
投資者.公司.factset_url
end。
end。
end。
uj5u.com熱心網友回復:
在條件中用方括號簡單地包住[和],因為要分配多個值。
def < span class="hljs-title">get_factset_url(投資者)
url, option = if !current_user.factset_enabled?
[url, {alert: "A paid subscription is required to view this." }]
elsif investor.company.is_fresh?
[url, {alert: "我們正在進行錄音。 我們對造成的不便表示歉意,但請耐心等待。" }]
elsif investor.company.is_fresh?
[url, {alert: "對不起,我們的投資者資料庫中沒有這個。 2)我們沒有網站或披露的資訊。"}]
else]]。
[投資者.公司.factset_url, nil]
end]
end。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/322750.html
標籤:
上一篇:實用組件內部的鉤子

