Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
Rei
@Rei
Admin
NO. 1 / 2011-10-28

[email protected]
深圳
198 Topics / 9208 Replies
732 Followers
0 Following
11 Favorites
中下水平 Rails 程序员
Reward
GitHub Public Repos
  • writings 940

    [Closed] Source code of writings.io

  • alipay 728

    Unofficial alipay ruby gem

  • code_campo 288

    [Closed] Source code of http://codecampo.com

  • asciidoctor-pdf-cjk-ka... 102

    **no longer maintained**

  • geeknote 39

  • material-ui 17

  • htmlrenderer 12

  • rich-text-editor 12

  • llmrpg 8

  • rails-chatgpt-demo 8

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 并发情况下无法依赖 cache counter 的问题 at June 02, 2019
    around_action :lock_shelf
    before_action :check_shelf_availability
    
    private
    
    def lock_shelf
      @shelf = ...
      @shelf.with_lock do
        yield
      end
    end
    
  • 并发情况下无法依赖 cache counter 的问题 at June 02, 2019

    创建 book 的时候 lock shelf

    https://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html

  • 昨晚 两 点才睡,就为了发布这个破玩意 (Luda - A lightweight and responsive UI framework for modern web development) at May 31, 2019

    很不错。

  • Rails 有没有类似于 Java 任务调度的 gem? at May 29, 2019

    要实现阻塞轮询,那么根本不用 worker:

    def run_jenkins
      white !jenkins_ready
        sleep 60
      end
      render
    end
    

    这里有几个问题:

    1. 用户执行这个操作后,页面就挂住了,好像服务器失去响应一样。
    2. app server 通常会有超时设置,例如超过 30 秒没完成就强制退出。
    3. 基于进程或线程的 app server 并发数减一,并会最终卡死。

    你还是先说说用户场景是什么?

  • Rails 有没有类似于 Java 任务调度的 gem? at May 29, 2019

    PS: X-Y Problem http://coolshell.cn/articles/10804.html

  • Rails 有没有类似于 Java 任务调度的 gem? at May 29, 2019

    两个问题:

    1. worker 是阻塞操作吗?
    2. 不返回前端页面用户端也一直阻塞吗?
  • Ruby 3 咋样了 at May 28, 2019

    已经在做了~

  • Rails 有没有类似于 Java 任务调度的 gem? at May 28, 2019

    sidekiq

  • Rails 有没有类似于 Java 任务调度的 gem? at May 28, 2019

    ActiveJob 用 wait 参数延时执行,任务末尾需要轮询的时候 enqueue 自己。

  • Migration 新增列并设置值,如何组织更新步骤? at May 27, 2019

    这种不一致的数据迁移我会单独写一个脚本,migration 只管模式迁移。

    我习惯一个迁移包含一个任务,顶楼情况,增加 user 表和添加 user_id 是一个任务(增加 User Model),去掉 default value 是另一个任务(这跟 User 有关吗?)。

  • ruby 使用 rest-client 一直无法成功,求助各位大佬! at May 23, 2019

    楼主不会真的贴了密码出来吧?赶紧改密码。

  • 关于 turbolinks:load 重复执行问题的研究 at May 19, 2019

    不要依赖 turbolinks:load 了,https://stimulusjs.org/ 是最适合 Turbolinks 的做法。

    https://github.com/turbolinks/turbolinks#attaching-behavior-with-stimulus

  • 求助,minimagick 无法打开本地图片 at May 14, 2019

    看了下源码 MiniMagick::Image.open 用的是 open-uri 实现,可以在终端自己试试用 open-uri 打开链接看看。

    另外代码效率比较低啊,每次渲染都要下载图片解析,activestorage 本身保存了图片 metadata 的。

  • Rails API 项目的后台 怎样写会比较好呢 at May 13, 2019
    1. 有多少性能损失得测过才知道。
    2. 用 Rails 默认栈不应该成为思想负担。
    3. 人力资源比服务器更贵。
  • 有给所有 model 自动生成类型标注的插件吗? at May 11, 2019

    IDE 可以读 schema.rb。

  • rails 项目中 YMAL.load_file 不解析 erb 模板 at April 30, 2019

    用 config_for https://guides.rubyonrails.org/configuring.html#custom-configuration

  • 我的黑苹果终于完美了 at April 29, 2019

    这样塑料小人会不会化掉……

  • Rails 6.0.rc1 已经在 Basecamp, Shopify 和 GitHub 的生产环境中跑起来了 at April 27, 2019

    这几家公司都是有人在核心维护组的,没有的话还是建议用稳定版。

  • 在 Windows 的机器使用 Capistrano 部署项目到 Linux 的服务器,提示访问不到远程仓库 at April 22, 2019

    自己鼓捣就 ssh forward agent 咯。

  • 在 Windows 的机器使用 Capistrano 部署项目到 Linux 的服务器,提示访问不到远程仓库 at April 22, 2019

    另外几个项目可能配置了 deploy key,同事机子可能配置了 ssh forward agent,不能排除服务器访问不到 repo 的问题。

    话说这问题不应该问同事吗?

  • 在 Windows 的机器使用 Capistrano 部署项目到 Linux 的服务器,提示访问不到远程仓库 at April 22, 2019

    cap 部署需要部署时服务器可以访问 git repo,可以选择在服务器上配置一个专门的 deploy key,或者通过 ssh forward agent 使用本地的 key。

  • Ruby 3 将有类型系统了 at April 20, 2019

    对我来说依然不觉得类型检查有什么必要,过去遇到的 Bug 几乎都跟类型没什么关系,只是可选的那就留待观察好了。(真香警告)

  • 中文字体嵌入工具 除了 font-spider 字蛛 有其他选择吗? at April 20, 2019

    为了一个字体增加首页几 M 下载量,说不定用户还是手机流量,真的值得吗?不如跟客户沟通一下,设定几个字体 fallback 到本地字体。

  • RSpec 如何实现动态定义 be_matcher at April 05, 2019

    这是 Rspec 引进不必要的复杂的一个体现,在 Minitest 里面定义自己的断言只需要定义 Ruby 方法:

    def assert_what_you_want(*args)
      # do something
      assert(except, actual, message)
    end
    
  • bootstrap-sass 3.2.0.3 版本被发现藏有远程执行代码后门 at April 05, 2019

    https://github.com/twbs/bootstrap-sass/issues/1195

  • bootstrap-sass 3.2.0.3 版本被发现藏有远程执行代码后门 at April 05, 2019

    卧槽,怀疑攻击者盗取了维护者的 gem 发布权限,发布了一个带后门的版本。

  • base64encode 的值通过 md5 不一致的问题 at April 03, 2019

    看你写了这行 #result.gsub!("\n", '') ,是不是遇到换行。

    puts result.inspect 打印看看有无换行。

    另外 Base64.strict_encode64 是生成无换行格式的。

  • open api 问题咨询 at April 02, 2019

    转 @huacnlee

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