• 但是可以按照国情,事故类型提供相关的指引,法律参考等,因为现在很多人想利用法律处理问题,但是不知道怎么入手。我觉得这个想法真的很好

  • 这种模式好像更适合相亲网站😀

  • 看上去很厉害

  • 为什么要把面试者面懵呢?楼上说的对,面试不是以为难面试为目的的,是要找到适合自己团队和自己开出薪资匹配的能力者。

  • 👍 👍

  • 招聘初级 web 前端工程师 at 2020年04月02日

    其实初不初级没所谓,关键他们的初级多少钱😎

  • 用户信息的页面编辑居然不能修改昵称啥的。模版背景色不能选白色?

  • 我毕业是找 c 的,结果干上了 ruby

  • 优秀

  • 很奇怪的问题,我的实验例子和楼主是一样的,但结果完全和楼主的不一样,我的实验结果完全证明了 9 楼@bysxiang的结论,想知道楼主的 ruby 版本

  • 我使用了直传阿里云 oss,奇怪的是没有数据库中没有生成 active_storage_attachments 记录,这是为什么呢?转成本地存储一切正常啊

  • 关于 rails 查询: at 2018年09月08日

    非常感谢,我确实没太多了解 scope,就之前浏览过一下源码,🙏

  • 嗯,我一开始老想着清除对应的 session,苦于没有办法找到对应的 session,而没有想到加过滤器来判断是否登陆,然后登出,思路不够开阔

  • 哇哇,大神终于出现了,您的方法我会一一尝试的,回复这么仔细,对于一个新手来说是真的感谢🙏 🙏 🙏

  • 看上去您的这个方案是可行的,稍后尝试一下,真心感谢!

  • 嗯,我的理解是:用户验证是发生在登录成功之后的,如果按照您的方法,退出的应该是当前机器上的这个用户,而不是之前机器登录的用户;还有就是,每次登录的 session_id 都不会一样的,判断是否一样貌似没有意义了。其实我现在的困惑可以转换为怎么根据 session_id 登出相应的用户。

    我这个需求按照产品的意思貌似不需要实时,只用后台登出就好了。感谢感谢!🙏

  • 您这个不是用户身份验证的么,不太明白您的意思

  • 这个方法我尝试过,但是没有登出,我使用两个浏览器登录同一个账户测试的

  • 感谢感谢! 我目前的思路是:在 users 表中增加 last_session_id 字段,用于存储上次登录生成的 session_id,登出的时候清空;然后每次登录之前检查 last_session_id 是否存在,如果存在,说明该用户已经登录,然后据此找到对应的 session 清空,但是我不知道怎么根据 session_id 找到对应的 session; 感觉原理和您给的思路差不多,但我对【自动登出】不会实操,尴尬了,看了半天 devise 源码,没看明白😭

  • 这样设计合理吗 at 2018年09月04日

    这要看业务了,如果不长更改的字段,为了查询,有少量冗余字段也没所谓,而且查询确实方便,但如果比较容易更改的字段就建议不要这么做,同步数据很麻烦,得不偿失

  • 非常感谢,已经可以了🙏

  • 错误日志在楼上,不知道为什么粘贴了错误日志没有回复某个人的格式

  • 去掉后错误日志是这样:

    rake aborted!
    Gem::LoadError: Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile.
    /usr/local/rvm/gems/ruby-2.4.0/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:404:in `block (2 levels) in replace_gem'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:950:in `establish_connection'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:60:in `establish_connection'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:27:in `<main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
    /usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
    /usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
    
    Caused by:
    Gem::LoadError: can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile.
    /usr/local/rvm/gems/ruby-2.4.0/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:404:in `block (2 levels) in replace_gem'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:950:in `establish_connection'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:60:in `establish_connection'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:27:in `<main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
    /usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
    /usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
    Tasks: TOP => db:migrate => db:load_config
    (See full trace by running task with --trace)
    
  • 去掉了

  • 诶,在尝试了重装 mysql 之后,我怀疑是 ruby 版本太低,升级了 ruby 为 2.5.0,还是不行,那应该改是 rails 版本问题,我把 rails 版本回退到 5.1.4 然后一切都好了,但是我依然不明到底是怎么回事,rails5.2.1 到底和我本地环境有什么冲突

  • 用这个 gem 是因为之前跑 rake db:migrate 时候出现如下错误:

    rake aborted!
    Gem::LoadError: Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile.
    /usr/local/rvm/gems/ruby-2.4.0/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:404:in `block (2 levels) in replace_gem'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:950:in `establish_connection'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:60:in `establish_connection'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:27:in `<main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
    /usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
    /usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
    
    Caused by:
    Gem::LoadError: can't activate mysql2 (< 0.6.0, >= 0.4.4), already activated mysql2-0.3.21. Make sure all dependencies are added to Gemfile.
    /usr/local/rvm/gems/ruby-2.4.0/gems/bundler-1.16.1/lib/bundler/rubygems_integration.rb:404:in `block (2 levels) in replace_gem'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:6:in `<main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:950:in `establish_connection'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_handling.rb:60:in `establish_connection'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/base.rb:27:in `<main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    /usr/local/rvm/gems/ruby-2.4.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
    /usr/local/rvm/gems/ruby-2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
    /usr/local/rvm/gems/ruby-2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
    /usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
    /usr/local/rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
    Tasks: TOP => db:migrate => db:load_config
    (See full trace by running task with --trace)
    

    貌似说缺少一些依赖,当时不知道这个 gem 基本被弃用,环境也是之前一直用的,不是很明白为什么会这样

  • 咦 - 不用 grape 不能用 swagger 嘛?,看看这个,https://ruby-china.org/topics/25822

  • 安装完 mysql 就可以了,我貌似和我最近重装虚拟机后遇到的问题一样

  • 灰常感谢!😀