<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>stephen (stephen)</title>
    <link>https://ruby-china.org/stephen</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>一个旧项目升级到 rails7，代码中的事务部分竟然跳过不执行了？</title>
      <description>&lt;p&gt;一个旧项目升级到 rails7，代码中的事务部分竟然跳过不执行了？难道还有什么开关设置？
数据库是 mysql，模式是 InnoDB&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;begin
      puts 0
      ActiveRecord::Base.transaction do
        puts 0
        a = dish_order.update!(status: :checkouted, pay_at: DateTime.now, payment_method: :abpay)
        ......
        render json: { code: 0, message: '支付成功', data: { } }, status: :ok and return
      end
    rescue =&amp;gt; e
      render json: { code: 1, message: e, data: {} }, status: :ok and return
    end
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>stephen</author>
      <pubDate>Sun, 29 Dec 2024 16:25:57 +0800</pubDate>
      <link>https://ruby-china.org/topics/43993</link>
      <guid>https://ruby-china.org/topics/43993</guid>
    </item>
    <item>
      <title>如果用 spreadsheet_architect 导出这样的表格</title>
      <description>&lt;p&gt;如果用 spreadsheet_architect 导出这样的表格&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/stephen/996f0352-9b21-4aed-a055-dfc30418eb2d.png!large" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Mon, 09 Dec 2024 21:14:16 +0800</pubDate>
      <link>https://ruby-china.org/topics/43979</link>
      <guid>https://ruby-china.org/topics/43979</guid>
    </item>
    <item>
      <title>群内有朋友对接过海康威视的云 API 吗？有偿帮忙解决问题</title>
      <description>&lt;p&gt;群内有朋友对接过海康威视的云 API 吗？有偿帮忙解决问题&lt;/p&gt;

&lt;p&gt;补充 API 文档&lt;/p&gt;

&lt;p&gt;&lt;a href="https://open.hikvision.com/download/5c67f1e2f05948198c909700?type=20" rel="nofollow" target="_blank"&gt;https://open.hikvision.com/download/5c67f1e2f05948198c909700?type=20&lt;/a&gt;&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Fri, 22 Nov 2024 14:12:35 +0800</pubDate>
      <link>https://ruby-china.org/topics/43963</link>
      <guid>https://ruby-china.org/topics/43963</guid>
    </item>
    <item>
      <title>有没有人在国产操作系统上开发过 rails？数据库也用国产数据库</title>
      <description>&lt;p&gt;基本目前形势，很多事业单位等系统已经逐渐使用国产系统和国产数据库。
不知道有没有人在国产操作系统上开发过 rails？数据库也用国产数据库&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Sun, 17 Nov 2024 15:09:34 +0800</pubDate>
      <link>https://ruby-china.org/topics/43950</link>
      <guid>https://ruby-china.org/topics/43950</guid>
    </item>
    <item>
      <title>ruby-docx 这个 gem 在打开文档时报错 undefined method `close' for nil:NilClass @zip.close </title>
      <description>&lt;p&gt;ruby-docx 这个 gem 在 open 时报错 undefined method `close' for nil:NilClass &lt;a href="/zip.close" class="user-mention" title="@zip.close"&gt;&lt;i&gt;@&lt;/i&gt;zip.close&lt;/a&gt; ，这个 gem 的 issue 里面有相关报错，说是只支持 docx，但是我改为了 docx 也一样报错。请问有人用过，解决过吗？或者有没有其他更好用的操作 word 的 gem&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;doc = Docx::Document.open("https://xsscrm.mform.cn/files/供水服务协议.docx")

doc.bookmarks['user_name'].insert_text_after("#{@water_installation.name}")
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;具体需求&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;通过word文档的书签功能，插入字符
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>stephen</author>
      <pubDate>Sun, 07 Jul 2024 10:10:55 +0800</pubDate>
      <link>https://ruby-china.org/topics/43801</link>
      <guid>https://ruby-china.org/topics/43801</guid>
    </item>
    <item>
      <title>Python 的 Masonite 会不会进一步压缩 Ruby + Rails 的生存空间了？</title>
      <description>&lt;pre class="highlight plaintext"&gt;&lt;code&gt;停止使用只有一些令人困惑的功能的旧框架吧！ Masonite 是专注于开发人员的开发工具，具有你应得的快速开发所需的所有功能。 Masonite 非常适合部署第一个 Web 应用程序的初学者或需要使用全部可用功能的高级开发人员和企业。

Masonite 努力实现从安装到部署的快速和简单，因此开发人员可以尽可能快速高效地从概念到创建。将它用于你的下一个 SaaS！尝试一次，你就会爱上它。
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;基于 python 大量的库和用户基础，感觉 ruby+rails 更艰难了&lt;img title=":joy:" alt="😂" src="https://twemoji.ruby-china.com/2/svg/1f602.svg" class="twemoji"&gt; &lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Fri, 10 Jun 2022 11:51:26 +0800</pubDate>
      <link>https://ruby-china.org/topics/42450</link>
      <guid>https://ruby-china.org/topics/42450</guid>
    </item>
    <item>
      <title>请教下，Rails + Turbolinks 如何做首屏加载 loading</title>
      <description>&lt;p&gt;请教下，rails + turbolinks 如何做首屏加载 loading&lt;/p&gt;

&lt;p&gt;尝试了 turbolinks 各种事件，但是都没有符合首屏加载&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Fri, 02 Oct 2020 15:25:41 +0800</pubDate>
      <link>https://ruby-china.org/topics/40456</link>
      <guid>https://ruby-china.org/topics/40456</guid>
    </item>
    <item>
      <title>请问有人对接过讯飞的转写接口吗？</title>
      <description>&lt;p&gt;请问有人对接过讯飞的转写接口吗？有的能否发上参考一下
根据文档提交参数，都报&lt;code&gt;转写业务通用错误&lt;/code&gt;&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Fri, 02 Aug 2019 11:15:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/38897</link>
      <guid>https://ruby-china.org/topics/38897</guid>
    </item>
    <item>
      <title>使用 Mina 部署，添加 Puma 或者 Sidekiq，就会提示 Could not locate Gemfile or .bundle/ directory 错误</title>
      <description>&lt;p&gt;环境：&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ruby 2.5.3    rails 5.2.3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;问题：&lt;/p&gt;

&lt;p&gt;使用 mina 部署，添加 puma 和 sidekiq，就会提示 Could not locate Gemfile or .bundle/ directory 错误，如果去除 puma 和 sidekiq 的语句，就能执行成功&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;desc&lt;/span&gt; &lt;span class="s2"&gt;"Deploys the current version to the server."&lt;/span&gt;
&lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="ss"&gt;:deploy&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;deploy&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="c1"&gt;#invoke :'sidekiq:quiet'&lt;/span&gt;
    &lt;span class="n"&gt;invoke&lt;/span&gt; &lt;span class="ss"&gt;:'git:clone'&lt;/span&gt;
    &lt;span class="n"&gt;invoke&lt;/span&gt; &lt;span class="ss"&gt;:'deploy:link_shared_paths'&lt;/span&gt;
    &lt;span class="n"&gt;invoke&lt;/span&gt; &lt;span class="ss"&gt;:'bundle:install'&lt;/span&gt;
    &lt;span class="n"&gt;invoke&lt;/span&gt; &lt;span class="ss"&gt;:'rails:db_migrate'&lt;/span&gt;
    &lt;span class="n"&gt;invoke&lt;/span&gt; &lt;span class="ss"&gt;:'deploy:cleanup'&lt;/span&gt;
    &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="s1"&gt;'npm install'&lt;/span&gt;
    &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="s1"&gt;'npm run prod-assets'&lt;/span&gt;

    &lt;span class="n"&gt;on&lt;/span&gt; &lt;span class="ss"&gt;:launch&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="n"&gt;in_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:current_path&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
        &lt;span class="c1"&gt;#invoke :'sidekiq:restart'&lt;/span&gt;
        &lt;span class="c1"&gt;#invoke :'puma:stop'&lt;/span&gt;
        &lt;span class="c1"&gt;#invoke :'puma:start'&lt;/span&gt;
        &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="s2"&gt;"rm -rf &lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:deploy_to&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/current/node_modules"&lt;/span&gt;
        &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="sx"&gt;%{mkdir -p tmp/}&lt;/span&gt;
        &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="sx"&gt;%{touch tmp/restart.txt}&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2019/4a543a8c-e989-41a9-8a3c-183ba306ca77.png!large" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Tue, 18 Jun 2019 10:08:46 +0800</pubDate>
      <link>https://ruby-china.org/topics/38655</link>
      <guid>https://ruby-china.org/topics/38655</guid>
    </item>
    <item>
      <title>需要做个类似 58 同城的分类信息系统，但是不明白其数据结构</title>
      <description>&lt;p&gt;需要做个类似 58 同城的分类信息系统，但是不明白其数据结构，表结构是如何设计的？
不同的分类，比如手机，租房，发布信息页面要填写的字段是不同的。
请教下大家是如何设计的或者 rails 有什么类似的开源项目可以参考下？&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Mon, 09 Jul 2018 11:17:33 +0800</pubDate>
      <link>https://ruby-china.org/topics/37122</link>
      <guid>https://ruby-china.org/topics/37122</guid>
    </item>
    <item>
      <title>城市级联选择还有什么好的 Gem 吗？</title>
      <description>&lt;p&gt;china_city 这个 gem 已经停止维护了，用在 rails5 里面有 bug，不知道现在有什么好的城市级联选择的 gem？&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Wed, 07 Feb 2018 09:33:56 +0800</pubDate>
      <link>https://ruby-china.org/topics/35004</link>
      <guid>https://ruby-china.org/topics/35004</guid>
    </item>
    <item>
      <title>由 openssl 引发的 rbenv 安装 ruby 错误，请教如何解决？</title>
      <description>&lt;p&gt;以下是错误代码，搜索过，根据网上的办法都解决不了，请求帮忙&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x86_64-linux-fake.rb updated
./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems -r./x86_64-linux-fake ./tool/rbinstall.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc" --install=all --rdoc-output=".ext/rdoc"
/tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require': /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/.ext/x86_64-linux/openssl.so: undefined symbol: EC_GROUP_new_curve_GF2m - /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/.ext/x86_64-linux/openssl.so (LoadError)
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/.ext/common/openssl.rb:13:in `&amp;lt;top (required)&amp;gt;'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/security.rb:12:in `&amp;lt;top (required)&amp;gt;'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/package.rb:44:in `&amp;lt;top (required)&amp;gt;'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/installer.rb:10:in `&amp;lt;top (required)&amp;gt;'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /tmp/ruby-build.20170811101100.32070/ruby-2.4.1/lib/rubygems/core_ext/kernel_require.rb:55:in `require'
        from ./tool/rbinstall.rb:653:in `&amp;lt;module:RbInstall&amp;gt;'
        from ./tool/rbinstall.rb:596:in `&amp;lt;main&amp;gt;'
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>stephen</author>
      <pubDate>Fri, 11 Aug 2017 10:20:21 +0800</pubDate>
      <link>https://ruby-china.org/topics/33802</link>
      <guid>https://ruby-china.org/topics/33802</guid>
    </item>
    <item>
      <title>上传 excel 文件，然后用 roo 读取文件内容，报 Zip::Error (Zip end of central directory signature not found):错误</title>
      <description>&lt;p&gt;上传 excel 文件，然后用 roo 读取文件内容，
报错代码&lt;code&gt;xlsx = Roo::Spreadsheet.open(tmp_file)&lt;/code&gt;
报&lt;code&gt;Zip::Error (Zip end of central directory signature not found):&lt;/code&gt;错误
google 有类似，但是解决不了
以下是我的代码&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def import
    tmp_file = "#{Rails.root}/tmp/import_xls.xlsx"
    FileUtils.mv params['import_xls'].tempfile.path, tmp_file
    require 'roo'
    xlsx = Roo::Spreadsheet.open(tmp_file)
    xlsx.each_row_streaming do |row|
      begin
        order = Order.where(trade_no: "#{row[0]}").first
        if not order.blank?
          order.update_attributes!(
            state: :sent,
            express_company: "#{row[7]}",
            express_no: "#{row[8]}"
          )
        end
      rescue =&amp;gt; exception
        Rails.logger.info exception
      end
    end
    render json: { success: 1, msg: "导入成功." }
  end
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>stephen</author>
      <pubDate>Fri, 28 Jul 2017 14:57:14 +0800</pubDate>
      <link>https://ruby-china.org/topics/33659</link>
      <guid>https://ruby-china.org/topics/33659</guid>
    </item>
    <item>
      <title>如果设计和实现储存类似 spreadsheet 的动态表格？</title>
      <description>&lt;p&gt;如果设计和实现储存类似 spreadsheet 的动态表格？
用 sql 还是 nosql？
数据库我用 postgresql&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Sun, 11 Dec 2016 21:10:05 +0800</pubDate>
      <link>https://ruby-china.org/topics/31877</link>
      <guid>https://ruby-china.org/topics/31877</guid>
    </item>
    <item>
      <title>需求方说 Ruby 是什么啊？我大上海没人认识！</title>
      <description>&lt;p&gt;接了一个外包，需要 php 做，但是我尝试推荐用 ruby+rails！
得到的反馈是：ruby 我找不到人啊，我认识了很多创业公司，都没人用 ruby。我也问了百度 xxx 级别的，你懂什么是百度 xxx 级别吗？都不会 ruby 也不用 ruby。我们大上海都不知道谁会用！
&lt;img title=":sweat_smile:" alt="😅" src="https://twemoji.ruby-china.com/2/svg/1f605.svg" class="twemoji"&gt; &lt;img title=":sweat_smile:" alt="😅" src="https://twemoji.ruby-china.com/2/svg/1f605.svg" class="twemoji"&gt; &lt;img title=":sweat_smile:" alt="😅" src="https://twemoji.ruby-china.com/2/svg/1f605.svg" class="twemoji"&gt; &lt;img title=":sweat_smile:" alt="😅" src="https://twemoji.ruby-china.com/2/svg/1f605.svg" class="twemoji"&gt; &lt;img title=":sweat_smile:" alt="😅" src="https://twemoji.ruby-china.com/2/svg/1f605.svg" class="twemoji"&gt; &lt;img title=":sweat_smile:" alt="😅" src="https://twemoji.ruby-china.com/2/svg/1f605.svg" class="twemoji"&gt; &lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Wed, 02 Nov 2016 20:54:01 +0800</pubDate>
      <link>https://ruby-china.org/topics/31511</link>
      <guid>https://ruby-china.org/topics/31511</guid>
    </item>
    <item>
      <title>请问下，现在 .im 的域名不能申请注册了？</title>
      <description>&lt;p&gt;请问下，现在.im 的域名不能申请注册了？&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Sat, 08 Oct 2016 12:48:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/31252</link>
      <guid>https://ruby-china.org/topics/31252</guid>
    </item>
    <item>
      <title>在线文档编辑软件是如何保存数据的？</title>
      <description>&lt;p&gt;在线文档编辑软件是如何保存数据的？类似石墨、google docs 等。是不是和富文本编辑器一样把一些 html 保存到数据库里，然后才转换成 word、excel 或者 ppt？&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Tue, 04 Oct 2016 09:06:21 +0800</pubDate>
      <link>https://ruby-china.org/topics/31232</link>
      <guid>https://ruby-china.org/topics/31232</guid>
    </item>
    <item>
      <title>现在手机太牛了，照的图片清晰度太高，体积太大，上传不了，大家是如何处理的？</title>
      <description>&lt;p&gt;现在手机太牛了，照的图片清晰度太高，体积太大，分辨率至少都几千，体积几 M 以上。
上传不了，大家是如何处理的？
前端手机 html5 上传图片，后台用 carrierwave 和 carrierwave-upyun。&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Sun, 03 Jul 2016 11:53:55 +0800</pubDate>
      <link>https://ruby-china.org/topics/30432</link>
      <guid>https://ruby-china.org/topics/30432</guid>
    </item>
    <item>
      <title>服务器会忽然挂掉，估计应该是 Nginx，但是日志没显示任何错误，应该要怎么排除问题？</title>
      <description>&lt;p&gt;服务器时不时会忽然挂掉，访问不了，估计应该是 nginx，但是日志没显示任何错误。
应该要怎么排除问题？&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Thu, 07 Apr 2016 21:35:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/29622</link>
      <guid>https://ruby-china.org/topics/29622</guid>
    </item>
    <item>
      <title>用 �SPA 的框架开发的应用如何和 Rails 的 Server 一起部署到同一台服务器？</title>
      <description>&lt;p&gt;用户的管理后台，用 rails 开发，没进行前后端分离，但是现在尝试把用户后台进行前后端分离。
但是由于这个后台访问量少，可以把 rails server 部署到同一台服务器？或者把前端放在 public 目录下？&lt;/p&gt;</description>
      <author>stephen</author>
      <pubDate>Sun, 20 Dec 2015 15:25:01 +0800</pubDate>
      <link>https://ruby-china.org/topics/28468</link>
      <guid>https://ruby-china.org/topics/28468</guid>
    </item>
  </channel>
</rss>
