Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Zheng Piaodan
@zhengpd
Member
NO. 21370 / 2015-09-30

自由职业
Guangdong
8 Topics / 157 Replies
12 Followers
0 Following
2 Favorites
GitHub Public Repos
  • cape 0

    🦸cape.el - Completion At Point Extensions

  • modus-themes.nvim 0

    Highly accessible themes for Neovim, conforming with the highest standard for color contrast betw...

  • zenbones.nvim 0

    🪨 A collection of contrast-based Vim/Neovim colorschemes

  • toggleterm.nvim 0

    A neovim lua plugin to help easily manage multiple terminal windows

  • nvim-lspconfig 0

    Quickstart configs for Nvim LSP

  • bamboo.nvim 0

    Warm Green Theme for Neovim and Beyond

  • trim.nvim 0

    This plugin trims trailing whitespace and lines.

  • Gogh 0

    Gogh is a collection of color schemes for various terminal emulators, including Gnome Terminal, P...

  • monokai-pro.nvim 0

    Monokai Pro theme for Neovim written in Lua, with multiple filters: Pro, Classic, Machine, Octago...

  • per-directory-history 0

    Per directory history for zsh, as well as global history, and the ability to toggle between them ...

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 大家一般线上环境的 migration 在什么时候执行? at April 18, 2025

    把数据库变更从应用启动过程中解耦出来,单独跑 db:migrate,跑完再上线业务代码,做好旧代码对于数据库新结构的兼容

  • 怎样写好注释 at March 26, 2025

    按我的经验,有帮助的注释大体上有几种:

    • How: 使用文档、调用说明这类的信息,说明注释的对象能做什么,怎么调用,有什么结果
    • Why: 比如为什么这么命名、为什么不处理边界情况、什么需求导致使用了这个技术方案,重点突出一个“为什么”
    • Todo: TODO/FIXME 这类留给未来做的任务,提醒读者注释的对象存在未完成的部分
  • m2 芯片部署问题 at May 24, 2023

    platforms 是 bundler 用来查找相应平台 gem 版本的,如果服务器不在 platforms 内就可能解析不到合适的 gem 进而导致部署失败

  • 想请教一下关于 Rails7 中关于集成测试的一个问题 at May 08, 2023

    ActionDispatch::IntegrationTest doesn't support access to encrypted cookies by design because they are integration tests and don't allow access to anything that a browser would not.

    你提到的那个 issue 有说,IntegrationTest 不允许访问浏览器访问不到的东西。rails 的 IntegrationTest 主要是通过发起 url 请求去测试一些业务流程实现是否正确,类似模拟浏览器行为,大概因为这样所以有这个限制设计

  • 有没有人有兴趣一起 fork 一个功能简单的 Homeland?使用 Crystal? at May 08, 2023

    感觉 crystal 超小众,希望看到一些 crystal 落地在企业业务项目的例子 👀

  • 想请教一下关于 Rails7 中关于集成测试的一个问题 at May 07, 2023

    把 assert_not logged_in? 去掉,不直接调用方法验证,改为通过发起请求验证是否登录状态,比如访问一个需要登录才能访问的页面,然后 assert_redirected_to login_url

  • m2 芯片部署问题 at May 07, 2023

    服务器 linux 可以 bundle lock --add-platform x86_64-linux.

  • 关于 Rails7 中 redirect_to 的一个小问题 at May 01, 2023

    如一楼说的,用错了方法,复数 users_url 对应的是 index action,单数 user_url 才是 show action

  • Rails 7 的中文教程出来了吗 at April 28, 2023

    中文 rails guides 已经很长时间没更新了 https://github.com/ruby-china/rails-guides

  • [solved] rails 安装问题 Rails is not currently installed on this system(裸装,没用虚拟环境) at April 24, 2023

    楼主是有特别的原因需要用系统级的 ruby?不然用 rtx 管理版本还是很方便的

  • 视频数据的保护有什么现成的解决方案吗? at April 29, 2022

    阿里云和腾讯云都有 hls 加密,可以看看

  • 请教一下 gem 依赖的 gem 的 constant 冲突了怎么解决 at April 04, 2022

    a 或 b 去掉,或者找不冲突的替代 gem.

    a 和 b 都用了 protobuf 功能,它们本身会不会可以相互替代

  • 想请教一下关于 gem 源码的问题 at April 04, 2022

    按 fork 的思路可以是:

    1. fork ruby-pg
    2. 尝试用 ruby-pg 连接 openguass,不出意外的话,会报错,研究和修复出现的错误,然后重复尝试
    3. 假如连接成功了,再根据具体的功能需求,去 ruby-pg 找对应部分的源码研究

    源码研究可以用 xmind 做思维导图,梳理文件结构和代码逻辑

    gem 结构和 c ext 楼上都有回复了

  • 想请教一下关于 gem 源码的问题 at April 04, 2022

    ruby-pg 的核心在 c 语言扩展里(ext 目录),模仿它写一个 gem 确实是很有难度。所以同一楼疑问,确定老师不是让你用 ruby-pg 写个工具连接到华为的数据库吗?🤨

  • 关于单表继承删除 super record 的问题 at April 04, 2022

    people.destroy 多少有点给自己加难度的感觉。如果在父类里边维护子类的关联关系处理,那就超出了父类职责范围,会增加维护 people model 的心智负担(难免有时候改代码会需要考虑对子类的影响,或者子类修改关联的时候还需要记得检查父类)。

    用了 STI 让父类职责简单好点,只负责子类通用的关联、属性和行为逻辑。在考虑需要删除子类关系时,people.destroy 实际上就不是子类通用的行为了,因为每个子类的处理逻辑不同。所以最好是直接就完全避免 people.destroy 。

    如果业务上真的就有 People 对应的业务需求实体,比如说“我要删除这个人,不管他是什么身份”,那么考虑做一个单独的 DestroyPeople service 处理后期更好维护。

  • 关于单表继承删除 super record 的问题 at April 03, 2022
    class People
      alias old_destroy destroy
      def destroy
        return old_destroy if type.blank?
    
        child = becomes(type.constantize)
        child.destroy
      end
    end
    

    可以试试

  • 问一个关于在 rails scope 中 join 表查询设置时 where 条件的问题 at March 18, 2022
    joins(:settings).where("users.attended_at + interval '1 minute' * settings.activation_duration > now()")
    

    大概是这么个方向,用 sql 比较时间差

  • Ruby 开发人员流失严重 at January 13, 2022

    这排名逻辑下最近注册用户没法露脸,新用户要拼了命回复才有机会赶上老用户多年积累啊

    感觉可以搞个本周活跃或者本月活跃

  • Rails 查询优化小手段-SQL Caching at January 12, 2022

    楼主高产 🚀

  • Ruby 开发人员流失严重 at January 12, 2022

    谁能描述下 top 100 的排序规则 🤔

  • 【请求支援帖子】请教一下,create_action 是什么意思? at January 12, 2022

    create_action 来自 action-store https://github.com/rails-engine/action-store

  • 启用 chrome custom doh 打不开 ruby china at December 24, 2021

    现在好了 👍

  • 有知道国内有 Rails 这方面的 agency 服务外包团队吗? at November 10, 2021

    广州乐豆啊,专业可靠 https://www.beansmile.com/

  • 简析 Rails 查询中的 includes 与 joins at November 09, 2021

    includes().where 会用 left outer join, joins() 默认是 Inner join,这点是不一样的

  • windows 的 ruby 怎么那么慢,是不是我的标装机的问题 at November 09, 2021

    启动慢估计是 cpu 性能不足或内存不够

    100k 带宽能干啥,ruby china 这个页面的 vendors.chunk.js 都 170k 了~~

  • (Zeitwerk Mode) DEPRECATION WARNING: Initialization autoloaded the constant ApplicationHelper at November 05, 2021

    rails 初始化过程中 autoload 的 ApplicationHelper,在改了文件触发 reload 之后的 ApplicationHelper 可能不一致,大概是这个问题

  • 我的论坛类 SideProject 但反响不好 求提点意见 at November 05, 2021

    可能你需要个邀请码机制,用稀缺性来吸引新用户 🤔

  • 我的论坛类 SideProject 但反响不好 求提点意见 at November 05, 2021

    什么内容都看不到,根本不想注册...

  • ruby 调用 WebService 用的是 https 的链接,如何解决证书的问题 at September 02, 2021

    https://stackoverflow.com/questions/199665/ruby-soap-ssl-woes

    require 'webrick/https' 可以试试这个

  • ruby 调用 WebService 用的是 https 的链接,如何解决证书的问题 at September 01, 2021

    偏个题:ruby 1.8.7 2013 年就 EOL 了,这么老的版本楼主公司还不安排升级下,可能新版 ruby or gem 就没问题了~

  • 1
  • 2
  • 3
  • 4
  • 5
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English