<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>xinyuanjieyi (xinyuanjieyi)</title>
    <link>https://ruby-china.org/xinyuanjieyi</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>本地想把 homeland 项目跑起来，但是报错了</title>
      <description>&lt;p&gt;ruby 3.0.3 rails 7.0.6&lt;/p&gt;

&lt;p&gt;用 docker 安装了 postgres，可以正确连接，我想用 rails s 启动起来，报错：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WARNING: table: "settings" does not exist or not database connection, `Setting.rack_attack` fallback to returns the default value.
WARNING: table: "settings" does not exist or not database connection, `Setting.rack_attack` fallback to returns the default value.
--&amp;gt; /Users/jieyi/workspace/study/homeland/app/models/user.rb

syntax error, unexpected ')'

    5  class User &amp;lt; ApplicationRecord
❯  67    def self.find_by_email(email)
❯  68      fetch_by_uniq_keys(email:)
❯  69    end
  168  end

syntax error, unexpected ')'
syntax error, unexpected end-of-input, expecting `end'

    5  class User &amp;lt; ApplicationRecord
❯  71    def self.find_by_login!(slug)
❯  72      find_by_login(slug) || raise(ActiveRecord::RecordNotFound.new(slug:))
❯  73    end
  168  end

--&amp;gt; /Users/jieyi/workspace/study/homeland/app/models/user.rb

syntax error, unexpected ')'

    5  class User &amp;lt; ApplicationRecord
❯  67    def self.find_by_email(email)
❯  68      fetch_by_uniq_keys(email:)
❯  69    end
  168  end

syntax error, unexpected ')'
syntax error, unexpected end-of-input, expecting `end'

    5  class User &amp;lt; ApplicationRecord
❯  71    def self.find_by_login!(slug)
❯  72      find_by_login(slug) || raise(ActiveRecord::RecordNotFound.new(slug:))
❯  73    end
  168  end

--&amp;gt; /Users/jieyi/workspace/study/homeland/app/models/user.rb

syntax error, unexpected ')'

    5  class User &amp;lt; ApplicationRecord
❯  67    def self.find_by_email(email)
❯  68      fetch_by_uniq_keys(email:)
❯  69    end
  168  end

syntax error, unexpected ')'
syntax error, unexpected end-of-input, expecting `end'

    5  class User &amp;lt; ApplicationRecord
❯  71    def self.find_by_login!(slug)
❯  72      find_by_login(slug) || raise(ActiveRecord::RecordNotFound.new(slug:))
❯  73    end
  168  end

/Users/jieyi/.rvm/gems/ruby-3.0.3/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': /Users/jieyi/workspace/study/homeland/app/models/user.rb:68: syntax error, unexpected ')' (SyntaxError)
    fetch_by_uniq_keys(email:)
                             ^
/Users/jieyi/workspace/study/homeland/app/models/user.rb:72: syntax error, unexpected ')'
...cord::RecordNotFound.new(slug:))
...                              ^
/Users/jieyi/workspace/study/homeland/app/models/user.rb:168: syntax error, unexpected end-of-input, expecting `end'
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>xinyuanjieyi</author>
      <pubDate>Mon, 11 Sep 2023 15:07:05 +0800</pubDate>
      <link>https://ruby-china.org/topics/43324</link>
      <guid>https://ruby-china.org/topics/43324</guid>
    </item>
    <item>
      <title>使用 rvm 安装 ruby 遇到 openssl 的问题</title>
      <description>&lt;p&gt;我的是 macbook pro2017 款的，版本 10.14.3 &lt;/p&gt;

&lt;p&gt;项目比较老，用的 rails3.2，我本地安装的 rvm 都是 2.4+ 的，我先用 ruby2.4.4 版本 bundle install 项目，可以正确执行&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails -v&lt;/code&gt;，显示 ruby 的版本版本&lt;/p&gt;

&lt;p&gt;但是&lt;code&gt;bundle exec rails s&lt;/code&gt;会提示错误&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/Users/jieyi/.rvm/gems/ruby-2.4.4/gems/rubysl-rexml-2.0.4/lib/rexml/text.rb:35: warning: constant ::Fixnum is deprecated
/Users/jieyi/.rvm/gems/ruby-2.4.4/gems/rubysl-rexml-2.0.4/lib/rexml/xpath_parser.rb:19: warning: constant ::Fixnum is deprecated
/Users/jieyi/.rvm/gems/ruby-2.4.4/gems/CFPropertyList-2.3.1/lib/cfpropertylist/rbCFTypes.rb:24: warning: constant ::Fixnum is deprecated
/Users/jieyi/.rvm/gems/ruby-2.4.4/gems/activesupport-3.2.22.5/lib/active_support/core_ext/numeric/time.rb:50:in `*': ActiveSupport::Duration can't be coerced into Integer (TypeError)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;我 google 一圈，试了很多，还是会提示这个错误，后来有人说 ruby 版本需要控制在 2.3，我本地就开始安装 ruby 2.3.3&lt;/p&gt;

&lt;p&gt;rvm install 2.3.3，无法正常安装成功会报错，报错如下&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Warning, new version of rvm available '1.29.12', you are using older version '1.29.11'.
You can disable this warning with:   echo rvm_autoupdate_flag=0 &amp;gt;&amp;gt; ~/.rvmrc
You can enable auto-update with:     echo rvm_autoupdate_flag=2 &amp;gt;&amp;gt; ~/.rvmrc
You can update manually with:        rvm get VERSION                         (e.g. 'rvm get stable')

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.3.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Failed to update Homebrew, follow instructions at

    https://docs.brew.sh/Common-Issues

and make sure `brew update` works before continuing.
Error running 'requirements_osx_brew_update_system ruby-2.3.3',
please read /Users/jieyi/.rvm/log/1692713412_ruby-2.3.3/update_system.log
Requirements installation failed with status: 1.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;我用&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PKG_CONFIG_PATH=/usr/local/Cellar/openssl@1.1 \
rvm install 2.3.3 \
--with-openssl-dir=/usr/local/Cellar/openssl@1.1 \
--with-openssl-lib=/usr/local/Cellar/openssl@1.1 \
--with-openssl-include=/usr/local/Cellar/openssl@1.1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;会安装成功，但是错误日志会提示&lt;code&gt;rvm install 2.3.3 cannot load such file -- openssl&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;折腾了一天，没有折腾出来，我想请教下社区大佬，我是安装好低版本问题就好了吗，还是需要解决&lt;code&gt;ActiveSupport::Duration can't be coerced into Integer&lt;/code&gt;问题，另外，我的电脑版本可以安装低版本了，为什么我无法关联 openssl 呢，谢谢🙏&lt;/p&gt;</description>
      <author>xinyuanjieyi</author>
      <pubDate>Tue, 22 Aug 2023 22:03:12 +0800</pubDate>
      <link>https://ruby-china.org/topics/43287</link>
      <guid>https://ruby-china.org/topics/43287</guid>
    </item>
    <item>
      <title>前端传递数组给 rails 后台，后台接收不到？</title>
      <description>&lt;p&gt;前端 vue，上传多张图片，文件循环用 formData.append 传递给 rails，rails 接收不到 files 数组，应该是两个，test1，test2，而后台只收到了一个
&lt;img src="https://l.ruby-china.com/photo/xinyuanjieyi/bcbd647d-3dd8-473b-8c78-45d1e937568b.png!large" title="" alt=""&gt;
&lt;img src="https://l.ruby-china.com/photo/xinyuanjieyi/9929acb8-0efa-475a-8b44-b8e605901299.png!large" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;更改 files 的名字可以收到
&lt;img src="https://l.ruby-china.com/photo/xinyuanjieyi/4ca648a3-71c7-4557-b680-6f9fcd4ca93a.png!large" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/xinyuanjieyi/20bf3f90-497d-42e3-8be0-77bdd4bdb310.png!large" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;这种如何解决，谢谢🙏&lt;/p&gt;</description>
      <author>xinyuanjieyi</author>
      <pubDate>Fri, 12 May 2023 23:25:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/43073</link>
      <guid>https://ruby-china.org/topics/43073</guid>
    </item>
  </channel>
</rss>
