Objective:事實(shí)
今天又解決了兩個(gè)我覺(jué)得我難以解決的問(wèn)題,心里十分開(kāi)心。(原來(lái)我以為解決不了,自己克服下還是可以解決的。)
第一個(gè)問(wèn)題:
Devise could not find the `Warden::Proxy` instance on your request environment. Make sure that your application is loading Devise and Warden as expected and that the `Warden::Manager` middleware is present in your middleware stack. If you are seeing this on one of your tests, ensure that your tests are either executing the Rails middleware stack or that your tests are using the `Devise::Test::ControllerHelpers` module to inject the `request.env['warden']` object for you.
是因?yàn)樵谑褂?ApplicationController.renderer 的時(shí)候 render 了一個(gè) template,會(huì)用到一些 gem 中的 helper method,比如 devise 的 current_user,但是很明顯的單獨(dú)引入一個(gè) template 不會(huì)有這些 method,所以需要解決方案,我這個(gè)例子是不需要引入 layout,所以就 layout: false 就解決問(wèn)題了,如果需要使用的話(huà),可以參考:http://www.thegreatcodeadventure.com/using-action-controller-renderers-in-rails-5-with-devise/
第二個(gè)問(wèn)題是:aasm_state 的狀態(tài),app 頁(yè)面沒(méi)有及時(shí)刷新(異步有延遲),所以點(diǎn)擊了一個(gè)從 A 改成 B 的按鈕,但其實(shí)狀態(tài)已經(jīng)是 B 或者別的狀態(tài),所以會(huì)出現(xiàn)問(wèn)題,所以修改了一下 api 返回的錯(cuò)誤信息,友好提示。
Reflective:感受
很久沒(méi)有這種感覺(jué)了。通過(guò)這兩天自己獨(dú)立解決問(wèn)題,可以看到自己不再那么害怕,而是當(dāng)作一次又一次的挑戰(zhàn)。我很希望自己可以一直這樣保持下去。
Interpretive:想法
我覺(jué)得這樣很好,我的想法就是我可以這樣繼續(xù)保持下去,從而找回自信。
Decisional : 決定
從今天的過(guò)程中總結(jié)經(jīng)驗(yàn):
- 一個(gè)問(wèn)題來(lái)了,首先不要去害怕,而是給自己暗示:可以解決的。
- 不要著急,耐心的去找下去。
- 找到原因并復(fù)現(xiàn)問(wèn)題。
- 解決問(wèn)題。