我在這個類的其他方法中訪問變量時遇到問題。這是我的例子:紅寶石。變量權限
class CustomersController < ApplicationController
def login
if params[:login].present? && params[:password].present?
**@cust_model** = Customers.new
redirect_to(:action => 'client_dashboard')
end
end
def client_dashboard
@cust_dashboard = **@cust_model**.dashboard(1)
end
end
我的錯誤是:未定義的方法儀表板
您的代碼中有語法錯誤。 '** @ cust_model **'應該可能是'@ cust_model' – tessi 2013-04-28 08:37:53
我想,他試圖用'code'語法中的markdown在不知不覺中將其加粗。 @PhilippTessenow – kiddorails 2013-04-28 08:39:52
是的...... @ cust_model應該是粗體的) – 2013-04-28 08:40:47