<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>QETHAN (Ethan)</title>
    <link>https://ruby-china.org/QETHAN</link>
    <description/>
    <language>en-us</language>
    <item>
      <title>怎么给 pg 的时间字段设置为带时区的？</title>
      <description>&lt;p&gt;Rails 默认生成的字段类型是 timestamp without timezone，在 pg 里边。不知道在 Rails7 里边怎么设置，可以带上 timezone？&lt;/p&gt;</description>
      <author>QETHAN</author>
      <pubDate>Sun, 25 Jun 2023 08:22:51 +0800</pubDate>
      <link>https://ruby-china.org/topics/43195</link>
      <guid>https://ruby-china.org/topics/43195</guid>
    </item>
    <item>
      <title>rails 创建项目时遇到几个红色提示，File unchanged! 不太明白这个提示是为什么？</title>
      <description>&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/QETHAN/05d3a894-c8db-4548-a328-854decaf09fb.png!large" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>QETHAN</author>
      <pubDate>Mon, 13 Mar 2023 15:31:07 +0800</pubDate>
      <link>https://ruby-china.org/topics/42934</link>
      <guid>https://ruby-china.org/topics/42934</guid>
    </item>
    <item>
      <title>发现了一个比较不错的 rails 学习网站</title>
      <description>&lt;p&gt;直接上网址：&lt;a href="https://www.codemy.net" rel="nofollow" target="_blank"&gt;https://www.codemy.net&lt;/a&gt;。个人感觉不错，分享给大家&lt;/p&gt;</description>
      <author>QETHAN</author>
      <pubDate>Wed, 19 Dec 2018 09:35:59 +0800</pubDate>
      <link>https://ruby-china.org/topics/37918</link>
      <guid>https://ruby-china.org/topics/37918</guid>
    </item>
    <item>
      <title>Grape swagger ui 展示 Array [Hash] 字段名称不正确</title>
      <description>&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/2018/38d96122-b3ef-43c3-bc30-bea77fe48fd7.png!large" title="" alt=""&gt;&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;optional&lt;/span&gt; &lt;span class="ss"&gt;:comments&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="no"&gt;Array&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; 
  &lt;span class="n"&gt;requires&lt;/span&gt; &lt;span class="ss"&gt;:content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;type: &lt;/span&gt;&lt;span class="no"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;allow_blank: &lt;/span&gt;&lt;span class="kp"&gt;false&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;正确的应该是 comments[][content], 请问这是 swagger 的 bug 吗&lt;/p&gt;</description>
      <author>QETHAN</author>
      <pubDate>Tue, 02 Jan 2018 14:37:23 +0800</pubDate>
      <link>https://ruby-china.org/topics/34806</link>
      <guid>https://ruby-china.org/topics/34806</guid>
    </item>
    <item>
      <title>\A [[:lower:]] 这个表达式中的:lower:是什么语法</title>
      <description>&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;lass&lt;/span&gt; &lt;span class="no"&gt;Person&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ApplicationRecord&lt;/span&gt;
  &lt;span class="n"&gt;validates_each&lt;/span&gt; &lt;span class="ss"&gt;:name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:surname&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kp"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kp"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'must start with upper case'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="sr"&gt;/\A[[:lower:]]/&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;</description>
      <author>QETHAN</author>
      <pubDate>Mon, 18 Dec 2017 23:20:06 +0800</pubDate>
      <link>https://ruby-china.org/topics/34725</link>
      <guid>https://ruby-china.org/topics/34725</guid>
    </item>
    <item>
      <title>UserMailer 里边定义的方法都是类方法？</title>
      <description>&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserMailer&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ApplicationMailer&lt;/span&gt;
  &lt;span class="n"&gt;default&lt;/span&gt; &lt;span class="ss"&gt;from: &lt;/span&gt;&lt;span class="s2"&gt;"xxx@example.com"&lt;/span&gt;


  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;account_activation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="vi"&gt;@user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;
    &lt;span class="n"&gt;mail&lt;/span&gt; &lt;span class="ss"&gt;to: &lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;subject: &lt;/span&gt;&lt;span class="s2"&gt;"账户激活"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;password_reset&lt;/span&gt;
    &lt;span class="vi"&gt;@greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hi"&lt;/span&gt;

    &lt;span class="n"&gt;mail&lt;/span&gt; &lt;span class="ss"&gt;to: &lt;/span&gt;&lt;span class="s2"&gt;"to@example.org"&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;在控制器里使用的时候都是直接用 UserMailer.account_activation(user), 不明白 account_activation 为什么变成了类方法&lt;/p&gt;</description>
      <author>QETHAN</author>
      <pubDate>Sat, 03 Dec 2016 11:57:18 +0800</pubDate>
      <link>https://ruby-china.org/topics/31780</link>
      <guid>https://ruby-china.org/topics/31780</guid>
    </item>
    <item>
      <title>路由设置里 scope module 怎么使用</title>
      <description>&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;scope&lt;/span&gt; &lt;span class="ss"&gt;:path&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'/api/v1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:module&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'api_v1'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:as&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'v1'&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
   &lt;span class="n"&gt;resources&lt;/span&gt; &lt;span class="ss"&gt;:projects&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;不太清楚怎么去组织文件夹和实例变量名称，
想知道有什么命令可以直接生成文件夹和模板代码吗？
大家开发中都是怎么做的，module 这个设置用的多吗&lt;/p&gt;</description>
      <author>QETHAN</author>
      <pubDate>Sun, 30 Oct 2016 16:28:22 +0800</pubDate>
      <link>https://ruby-china.org/topics/31474</link>
      <guid>https://ruby-china.org/topics/31474</guid>
    </item>
    <item>
      <title>Rails4 render js: xxx 报异常 InvalidCrossOriginRequest</title>
      <description>&lt;p&gt;按照 Rails4 文档，使用 render js: , 页面上给出：Security warning: an embedded  tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.  谷歌搜索了，没有找到一个清晰的解决办法。Rails 新手，请多指教！谢谢
&lt;/p&gt;</description>
      <author>QETHAN</author>
      <pubDate>Sat, 21 Jun 2014 12:42:52 +0800</pubDate>
      <link>https://ruby-china.org/topics/20093</link>
      <guid>https://ruby-china.org/topics/20093</guid>
    </item>
    <item>
      <title>Rails 现在常用的 gem 有哪些</title>
      <description>&lt;p&gt;初入 Rails,  好多 gem 都不知道。想问一下老手是怎么熟悉那些常用的 gems 和 找到自己想要的 gem?&lt;/p&gt;</description>
      <author>QETHAN</author>
      <pubDate>Sat, 21 Jun 2014 09:33:40 +0800</pubDate>
      <link>https://ruby-china.org/topics/20090</link>
      <guid>https://ruby-china.org/topics/20090</guid>
    </item>
    <item>
      <title>Rails 可以不使用 FormHelper 吗</title>
      <description>&lt;p&gt;Rails 可以不使用 FormHelper 吗？比较喜欢单纯的 HTML 结构。而且感觉使用 FormHelper 的话，class 的命名和添加都不方便。初入 Rails，请多指教。谢谢&lt;/p&gt;</description>
      <author>QETHAN</author>
      <pubDate>Fri, 20 Jun 2014 11:59:02 +0800</pubDate>
      <link>https://ruby-china.org/topics/20075</link>
      <guid>https://ruby-china.org/topics/20075</guid>
    </item>
  </channel>
</rss>
