2018-06-26

Objective:事实

今天又解决了两个我觉得我难以解决的问题,心里十分开心。(原来我以为解决不了,自己克服下还是可以解决的。)

第一个问题:

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.

是因为在使用 ApplicationController.renderer 的时候 render 了一个 template,会用到一些 gem 中的 helper method,比如 devise 的 current_user,但是很明显的单独引入一个 template 不会有这些 method,所以需要解决方案,我这个例子是不需要引入 layout,所以就 layout: false 就解决问题了,如果需要使用的话,可以参考:http://www.thegreatcodeadventure.com/using-action-controller-renderers-in-rails-5-with-devise/

第二个问题是:aasm_state 的状态,app 页面没有及时刷新(异步有延迟),所以点击了一个从 A 改成 B 的按钮,但其实状态已经是 B 或者别的状态,所以会出现问题,所以修改了一下 api 返回的错误信息,友好提示。

Reflective:感受

很久没有这种感觉了。通过这两天自己独立解决问题,可以看到自己不再那么害怕,而是当作一次又一次的挑战。我很希望自己可以一直这样保持下去。

Interpretive:想法

我觉得这样很好,我的想法就是我可以这样继续保持下去,从而找回自信。

Decisional : 决定

从今天的过程中总结经验:

  1. 一个问题来了,首先不要去害怕,而是给自己暗示:可以解决的。
  2. 不要着急,耐心的去找下去。
  3. 找到原因并复现问题。
  4. 解决问题。

你可能感兴趣的:(2018-06-26)