Home
Yates Zhang
Cancel

Rails Pluck Vs Map

refer to:  https://stackoverflow.com/questions/45347317/which-one-is-faster-between-map-collect-select-and-pluck pluck:  pick 1 attribute from array map: re-implement your function my_ar...

Rails Rspec Factory Girl

例子,如果某个model对应的factory定义为: factory  :tx do   blockend block为一个独立的model,  tx belongs_to block 那么,在创建的该tx的时候,我们应该: create :tx, block: Block.new 不应该这样调用:   create :tx, bl...

Rails Mysql Utf8mb4 Mysql2error Incorrect String Value Error

refer to: https://stackoverflow.com/questions/22464011/mysql2error-incorrect-string-value 1. change your  database.yml: development: adapter: mysql2 database: db username: password: ...

Mysql Too Many Connections

refer to: https://www.thegeekdiary.com/mysql-error-too-many-connections-and-how-to-resolve-it/ This error is caused by mysql, but not rails config. check variable: max_connections: SHOW VARIAB...

Rails Sidekiq有点可怕啊

1. 无法根据redis来准确删除某个任务,隐藏的特别深,只能使用flushall 2. 网上的策略都不好使,例如: https://stackoverflow.com/questions/25889699/sidekiq-stop-one-single-running-job https://stackoverflow.com/questions/48348723/sidekiq-lis...

Rails Upsert的使用解释 必须与id配合才可以

refer to :  https://stackoverflow.com/questions/4695563/upsert-in-rails-activerecord https://stackoverflow.com/questions/58759765/how-does-the-upsert-function-in-rails-work https://apidock....

Data Too Long For Text Field

refer to: https://github.com/vinsol-spree-contrib/spree_themes/issues/26 issue description Mysql2::Error: Data too long for column 'nmap_result' at row 1 (ActiveRecord::ValueTooLong) from /home/...

连接postgre数据库时报error:column_proisagg_dose_not_exist

连接Postgre数据库时报ERROR:column "proisagg" dose not exist 需要升级pgadmin了. 非常奇怪 refer to:  https://blog.csdn.net/weixin_44671994/article/details/87935656 我的pg_admin是3.x 的.需要升级了.

为git_commit_增加签名

refer to:  https://gist.github.com/ankurk91/c4f0e23d76ef868b139f3c28bde057fc  https://www.linuxjournal.com/content/signing-git-commits 1. 创建一个新的gpg:  # Ubuntusudo apt-get install gpa...

Go单元测试 Unit Test For Go

单元测试,一个不断被强调,但又不断被忽略的话题,从一名码农成长为一名优秀的工程师,单元测试,是必不可少的技能。单元测试是在所有测试环节中最先完成的,在我们写代码的过程中就需要写单元测试,也可能在未写代码前先写测试。个人认为编码能力,代码评审和单元测试是一个研发同学必备的三大重要技能。 Go常用测试框架 框架名称特征优点缺点备注Testingtable-driver测试支持基准测试Go原生简...