Ruby China
  • 社区
  • 招聘
  • Wiki
  • Gems
  • 注册
  • 登录
Peter
@Peter
高级会员
第 1553 位会员 / 2012-03-23

长沙
109 篇帖子 / 1505 条回帖
39 关注者
0 正在关注
322 收藏
打赏作者
未设置 GitHub 信息。
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • Egg:一门没有 GC、但内存安全的小语言(编译器用 Spinel 能编译的 Ruby 子集写成) at 2026年11月10日

    看了一下 Egg 的语法,目前整体风格似乎更接近 Zig。

    想请教一下,在设计 Egg 时,有没有考虑过采用 Ruby 风格的关键字和语法结构(例如 def...end、case...when),让它具有更强的 Ruby-like syntax?

    选择目前这种语法风格,主要是出于解析器实现、静态类型系统和所有权语义方面的考虑,还是有其他设计上的权衡(design trade-offs)?

  • 最近爆出的 gitlab 的漏洞,其实是所有 ruby 的都有的问题,兄弟们升级吧 at 2026年10月26日

    升级了,谢谢,最近光看别的语言的热闹了,想不到 Ruby 也有!有了 AI 是不是闭源安全一点 :)

  • Matz 合并了我给 Spinel 的一个 PR,顺便介绍下这个 Ruby AOT 编译器 at 2026年10月03日

    能力越大责任越大,大佬再做一个 spinel 的 windows port 吧,Windows 搞定后就可以做一个 Sails 了,用来打败 Electron, Tauri, Wails.

  • 面试官问"DeepSeek 开始峰谷定价了,你怎么看 AI 商业模式" at 2026年07月31日

    感觉是自嗨爽文或脱敏的钓鱼文章,如果没入职才有可能泄漏面试题。

  • 怎么让 AI 写出更有 Rails 味的代码? at 2026年07月02日

    Rails Service 只是一个单纯处理单一动作的 Ruby 类,通常会包装在一个 call 方法中,如果场景合适,我觉得也是 rails 味的,以下是上古时期的学习资料:
    https://www.toptal.com/developers/ruby-on-rails/rails-service-objects-tutorial
    https://www.honeybadger.io/blog/refactor-ruby-rails-service-object/
    https://dev.to/joker666/ruby-on-rails-pattern-service-objects-b19
    https://codeclimate.com/legacy/7-ways-to-decompose-fat-activerecord-models
    https://blog.appsignal.com/2020/09/16/rails-concers-to-concern-or-not-to-concern.html

    Fat model 其实也是问题,拆成 concerns, service 是常规操作。

    俱往矣,现在都是闭着眼睛 PUA Opus 了。

  • 最新的不一定好——预防供应链攻击 at 2026年06月01日

    总会有小白鼠的,但不能是我 :)

  • 11 英寸 MacBook 的第二春:从零开始配置 Ruby on Rails 开发环境 at 2026年05月11日

    给新的的说明,不错。

    https://gorails.com/setup/macos/26-tahoe

    我以前用 rbenv, 现在用 mise

  • Spinel -- Ruby AOT 编译器 at 2026年04月25日

    matz 也用上了 claud,一个月搞定 rewritten

  • 我最近想用纯 rust 实现一个 ruby 的代码格式化工具,想听听大家的想法 at 2026年03月01日

    现在都不手写代码了,提交前用一下 bin/rubocop -f github -a

  • vibe 了个很少依赖的跨平台服务器监控,开源,必须开源 at 2026年02月06日

    很好,是不是要加个 ping 服务,因为上次我的服务器没挂,nginx 挂了。然后再配个 resend 邮件服务,如果网站掉线直接发邮件

  • T-Ruby, TypeScript-style types for Ruby language at 2026年01月21日

    对生态很好的补充。

    你们职业生涯以来因为数据类型导致的 bugs 遇到过几例,我几乎没有这方面的记忆。 现在几乎也是 AI 写代码,估计现在 AI 也不习惯用 T-Ruby。

  • 注册域名的 Rubyist 注意了! at 2026年01月09日

    无法想象,这公司的人脑子进水了吗?为什么为难老百姓。再说让别人限期搬走也可以啊,这域名过期还没法续费。

  • Ruby 4.0 发布 🎉 at 2025年12月30日

    生产环境不急着升吧。

  • Basecamp 上线并开源看板应用 Fizzy at 2025年12月19日

    我还没转正,不能留言,如果你有空可以介绍一下多租户的思路吗?谢谢!

    粗看了一下,好像实现得不太灵活,下面这篇感觉更灵活,但会复杂很多:
    ​https://jumpstartrails.com/docs/accounts

  • 请问下是否有开源的外卖小程序平台比较好用,类美团的多商户系统 at 2025年12月12日

    我的意思是基于别人的改造,还不如自己搭,Rails 加上 AI, 应该很快。改别人的说不定不适合自己,还有很多潜在的坑你也不知道,这种涉及交费的系统,稍不注意可能要破财。

  • 请问下是否有开源的外卖小程序平台比较好用,类美团的多商户系统 at 2025年12月08日
    gem "devise"
    gem "rolify"
    gem "pundit"
    

    每个商户一个 tenant_id, 然后就是 CRUD, 这不分分钟就搭好了吗?

    class Tenant < ApplicationRecord
      has_many :users
      has_many :shops # 加钱后, 每个商户还能开多个商店
    
    class User < ApplicationRecord
      belongs_to :tenant, optional: true
      has_and_belongs_to_many :shops 
    
    class Role < ApplicationRecord
      validates :name, presence: true, uniqueness: true
    
      has_and_belongs_to_many :users, :join_table => :users_roles
    
  • 把 Mac 变成键盘流神器:Hammerspoon 配置指南(窗口管理 + 应用秒开 + 快捷键自定义) at 2025年11月30日

    很棒!

    下面是我的分屏脚本

    hs.window.animationDuration = 0
    units = {
      left50        = { x = 0.00, y = 0.00, w = 0.50, h = 1.00 },
      right50       = { x = 0.50, y = 0.00, w = 0.50, h = 1.00 },
      up50          = { x = 0.00, y = 0.00, w = 1.00, h = 0.50 },
      down50        = { x = 0.00, y = 0.50, w = 1.00, h = 0.50 },
      left30        = { x = 0.00, y = 0.00, w = 0.30, h = 1.00 },
      mid55         = { x = 0.30, y = 0.00, w = 0.55, h = 1.00 },
      right15       = { x = 0.85, y = 0.00, w = 0.15, h = 1.00 },
      maximum       = { x = 0.00, y = 0.00, w = 1.00, h = 1.00 }
    }
    
    coc = { 'ctrl', 'option', 'cmd' }
    hs.hotkey.bind(coc, 'left',  function() hs.window.focusedWindow():move(units.left50,    nil, true) end)
    hs.hotkey.bind(coc, 'right', function() hs.window.focusedWindow():move(units.right50,   nil, true) end)
    hs.hotkey.bind(coc, 'up',    function() hs.window.focusedWindow():move(units.up50,      nil, true) end)
    hs.hotkey.bind(coc, 'down',  function() hs.window.focusedWindow():move(units.down50,    nil, true) end)
    hs.hotkey.bind(coc, 'j',     function() hs.window.focusedWindow():move(units.left30,    nil, true) end)
    hs.hotkey.bind(coc, 'k',     function() hs.window.focusedWindow():move(units.mid55,     nil, true) end)
    hs.hotkey.bind(coc, 'l',     function() hs.window.focusedWindow():move(units.right15,   nil, true) end)
    hs.hotkey.bind(coc, 'm',     function() hs.window.focusedWindow():move(units.maximum,   nil, true) end)
    
    -- bind hotkey
    hs.hotkey.bind(coc, 'n', function()
      -- get the focused window
      local win = hs.window.focusedWindow()
      -- get the screen where the focused window is displayed, a.k.a. current screen
      local screen = win:screen()
      -- compute the unitRect of the focused window relative to the current screen
      -- and move the window to the next screen setting the same unitRect 
      win:move(win:frame():toUnitRect(screen:frame()), screen:next(), true, 0)
    end)
    
  • 用 mruby 的来了 Hola: Brewfile + mise.toml + dotfiles = 你的开发环境 at 2025年11月30日

    看上去不错,还没试过,如果在 ~/.config/hola/provision.rb 添加了新的项目,那些已经执行过的老项目还会重复执行一次吗?

  • 过时的 Wiki 可以下掉吧? at 2025年11月02日

    我以前一直用 Mac, 直到现在公司配了 Window 电脑,发现 WSL 也很好用,再加上 docker, 完全没问题。

  • Vim Elysium: 终极 Vim 配置,一键变身现代 IDE (2025 版) at 2025年10月23日

    很棒!不过 2025 年的 Feature list 里 Ctrl + F 怎么没找到 AI

  • 2025 大家体感就业形势如何 at 2025年10月22日

    我的经验是找工作就像找对象,你在找公司,公司也在找你,如果刚好对上了,那真的很容易。如果你身怀 Ruby 绝技,公司却要找个 C++, 那就难了。

  • Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025) at 2025年10月13日

    https://github.com/socketry/falcon 建议在生产环境中不要这样做,作者说的是 I saw an opportunity

    Once I had something working, I saw an opportunity to simplify my development, testing and production environments, replacing production (Nginx+Passenger) and development (Puma) with Falcon.

  • LLM Agent 开发:Ruby 可能被低估了 at 2025年10月09日

    非常感谢你的第一手经验分享,不知道除了自动整理文件、定时发邮件之外,还有没有可能分享其它不涉密的案例,这样可以帮助大家打开思路。

    比如: https://geeknote.net/Rei/posts/3252

  • Geeknote 开源 at 2025年09月18日

    这个要留言点赞,Ruby on Rails 界的一件年度大事。

  • Rails + Postgresql17 使用 NULLS NOT DISTINCT 还是无法唯一索引允许多个 NULL at 2025年09月15日

    问了 ChatGPT, 它说:

    在 PostgreSQL 里,默认情况下唯一索引会允许多个 NULL, 但如果你指定了 NULLS NOT DISTINCT,就会把 NULL 当作相等值处理,从而不允许多个 NULL 出现。

    所以你可以试试去掉 nulls_not_distinct: true. 这 nulls_not_distinct 其实说得也很直白,就是把多个 nulls 认定为非 distinct, 插入第二个 null 就破坏了 distinct.

    我没花时间尝试,这种情况我一般像 @Rei 那样找个大众一点的方式,这样才不会出小众的错。

  • 好消息:RubyMine 现在对非商业用途免费 at 2025年09月10日

    jetbrains 现在有点被动了,我现在都用 cursor + claude-4-sonnet

    以前买过商业许可,他们搞的是复杂的 perpetual fallback license, 就算是一年内的后续版本修复了 Bug 也要让我退回一年前有 Bug 的版本。 至少要把 Bugfix 和 Features 分开吧,这种 license 只能每年交年费。

  • Omarchy 成功运行在 Surface Pro 7 上 at 2025年09月07日

    可以试一下,基本还是可用的。个人感觉 Sonoma 比 Sequoia 要流畅一些。

  • 国内还有多少公司主力使用 Ruby at 2025年09月07日

    有机会的时候多布道,这样社区会壮大,这样才能有更多公司用 Ruby, 如果能加入用 Ruby 的公司,自己就可以不写让自己难受的 js, java 等代码了。

    使用 Ruby 的公司在减少,这是事实,但市场还是挺大的,如果自己水平不错,工资比 php, js , java 还是要高不少,错开了与那一大堆人的竞争。

    一个人同时只能做一两份工作,有机会就用自己喜欢的语言,框架,同时保持学习其它语言,了解优缺点,最好拿小项目多练练手,这样在没工作的时候,也是可以接受其它语言的工作的,如果可能接了别的工作后,可以先画饼,在局部加入 Ruby, 比如 micro service 的某部分,一旦效果不错,再画更大的饼就可以继续友好扩张。

  • Omarchy 成功运行在 Surface Pro 7 上 at 2025年09月03日

    12 年的 mbp 跑 Omarchy 绝对没问题,用 oclp 还能跑 Sequoia 15.7, windows 11 驱动也是全的。

    换个 2TB SSD, 再换一下硅脂,清一下风扇,还可以再战 10 年。

  • Omarchy 成功运行在 Surface Pro 7 上 at 2025年09月03日

    真的不想试一下 oclp 吗?

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