<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>shin (Shin)</title>
    <link>https://ruby-china.org/shin</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>遇到一个 aliyun direct upload 错误，求助。</title>
      <description>&lt;p&gt;在本地开发环境上传阿里云，直传阿里云都没什么问题；在生产环境上传阿里云也没问题，但直传阿里云出现错误，如下错误信息&lt;/p&gt;

&lt;p&gt;&lt;img src="https://l.ruby-china.com/photo/shin/1d6d22ec-c2d0-4074-bf57-7db97d8a79ba.png!large" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;rails 版本 7.1 
activestorage-aliyun '~&amp;gt; 1.2'&lt;/p&gt;

&lt;p&gt;各位大神如何处理这个错误，感谢！&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Fri, 31 May 2024 00:38:25 +0800</pubDate>
      <link>https://ruby-china.org/topics/43717</link>
      <guid>https://ruby-china.org/topics/43717</guid>
    </item>
    <item>
      <title>又一个不错的 Rails 视频教学网站</title>
      <description>&lt;p&gt;&lt;a href="https://www.driftingruby.com/" rel="nofollow" target="_blank"&gt;https://www.driftingruby.com/&lt;/a&gt;&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Thu, 13 Apr 2017 16:01:07 +0800</pubDate>
      <link>https://ruby-china.org/topics/32775</link>
      <guid>https://ruby-china.org/topics/32775</guid>
    </item>
    <item>
      <title>请教一个写 API 时遇到的问题</title>
      <description>&lt;p&gt;我用 active_model_serializers；有 3 个类&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserSerializer&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveModel&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Serializer&lt;/span&gt;
  &lt;span class="n"&gt;attributes&lt;/span&gt; &lt;span class="ss"&gt;:id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:authentication_token&lt;/span&gt;

  &lt;span class="n"&gt;has_many&lt;/span&gt; &lt;span class="ss"&gt;:posts&lt;/span&gt;
  &lt;span class="n"&gt;has_one&lt;/span&gt; &lt;span class="ss"&gt;:profile&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ProfileSerializer&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveModel&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Serializer&lt;/span&gt;
  &lt;span class="n"&gt;attributes&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;:bio&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:avatar&lt;/span&gt;

  &lt;span class="n"&gt;belongs_to&lt;/span&gt; &lt;span class="ss"&gt;:user_id&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PostSerializer&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveModel&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Serializer&lt;/span&gt;
  &lt;span class="n"&gt;attributes&lt;/span&gt; &lt;span class="ss"&gt;:id&lt;/span&gt;&lt;span class="p"&gt;,&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;:video&lt;/span&gt;

  &lt;span class="n"&gt;belongs_to&lt;/span&gt; &lt;span class="ss"&gt;:user&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;我在 api/v1/posts.json 下可以列出 post 数据和 user 数据，那在移动端就可以 Get 和 initialize 数据，我希望能在 api/v1/posts.json 下也能列出 profile 的数据，这样在移动端的页面可以显示每篇 post 的内容和用户名，用户头像；（这因该是在服务器端把数据都列出来，还是在移动端根据 user_id 查询 profile 数据？）&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Api::V1::PostsController&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;Api&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;V1&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;BaseController&lt;/span&gt;
    &lt;span class="n"&gt;load_and_authorize_resource&lt;/span&gt; &lt;span class="ss"&gt;except: &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:show&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;
        &lt;span class="n"&gt;posts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;
        &lt;span class="n"&gt;paginate&lt;/span&gt; &lt;span class="ss"&gt;json: &lt;/span&gt;&lt;span class="n"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;per_page: &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;status: &lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;309&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"video"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nl"&gt;"video"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"http://test.7xo9gv.com1.z0.glb.clouddn.com/uploads/tumblr_nu7jc4y4sI1udfmeqo1_500.gif?e=1465652771&lt;/span&gt;&lt;span class="se"&gt;\u&lt;/span&gt;&lt;span class="s2"&gt;0026token=VVHcT1wQxm_qS45p-4s2TEM7dtDlWk-yTMrC_eu5:v87uXlAjiQrCKe-kHDaPB7Dxp5="&lt;/span&gt;&lt;span class="p"&gt;}},&lt;/span&gt;&lt;span class="nl"&gt;"user_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"shin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"shin@gmail.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"authentication_token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"S_apCGF3wodNtKzWkeGYtYZ3dJxFPX-8"&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</description>
      <author>shin</author>
      <pubDate>Sat, 11 Jun 2016 21:01:35 +0800</pubDate>
      <link>https://ruby-china.org/topics/30250</link>
      <guid>https://ruby-china.org/topics/30250</guid>
    </item>
    <item>
      <title>遇到一个测试问题，搞了好几天没搞定！</title>
      <description>&lt;p&gt;集成测试登录的问题，环境是 rails 5.0.0.rc1 , devise 4.1.0&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# intergation/users_login_test.rb&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'test_helper'&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UsersLoginTest&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActionDispatch&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;IntegrationTest&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;setup&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;users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:michael&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

  &lt;span class="nb"&gt;test&lt;/span&gt; &lt;span class="s2"&gt;"login with valid information"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;post&lt;/span&gt; &lt;span class="n"&gt;user_session_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;session: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;email: &lt;/span&gt;&lt;span class="vi"&gt;@user.email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;password: &lt;/span&gt;&lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;assert_redirected_to&lt;/span&gt; &lt;span class="vi"&gt;@user&lt;/span&gt;
    &lt;span class="n"&gt;follow_redirect!&lt;/span&gt;
    &lt;span class="n"&gt;assert_select&lt;/span&gt; &lt;span class="s2"&gt;"a[href=?]"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_session_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;count: &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# users.yml&lt;/span&gt;
&lt;span class="na"&gt;michael&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Michael&lt;/span&gt;
  &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;michael@example.com&lt;/span&gt;
  &lt;span class="na"&gt;encrypted_password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;%= User.new.send(:password_digest, "password") %&amp;gt;&lt;/span&gt;
  &lt;span class="na"&gt;admin&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;Failure&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="no"&gt;UsersLoginTest&lt;/span&gt;&lt;span class="c1"&gt;#test_login_with_valid_information&lt;/span&gt;
&lt;span class="no"&gt;Expected&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;be&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="no"&gt;XX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;redirect&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;but&lt;/span&gt; &lt;span class="n"&gt;was&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;OK&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;以上，浏览器手动测试都正确的，但测试就过不了！&lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;第二个问题，上面的 users_login_test.rb 替换 devise sign_in 方法&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# intergation/users_login_test.rb&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'test_helper'&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UsersLoginTest&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActionDispatch&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;IntegrationTest&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;setup&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;users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:michael&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

  &lt;span class="nb"&gt;test&lt;/span&gt; &lt;span class="s2"&gt;"login with valid information"&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;sign_in&lt;/span&gt; &lt;span class="ss"&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="n"&gt;assert_redirected_to&lt;/span&gt; &lt;span class="vi"&gt;@user&lt;/span&gt;
    &lt;span class="n"&gt;follow_redirect!&lt;/span&gt;
    &lt;span class="n"&gt;assert_select&lt;/span&gt; &lt;span class="s2"&gt;"a[href=?]"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user_session_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;count: &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;test_helper.rb 有正确引入&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# test_helper.rb&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ActionController::TestCase&lt;/span&gt;
  &lt;span class="kp"&gt;include&lt;/span&gt; &lt;span class="no"&gt;Devise&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;TestHelpers&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;会遇到没有 sign_in 方法错误！&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NoMethodError: undefined method `sign_in' 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;抓狂！&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Thu, 12 May 2016 10:40:32 +0800</pubDate>
      <link>https://ruby-china.org/topics/29991</link>
      <guid>https://ruby-china.org/topics/29991</guid>
    </item>
    <item>
      <title>刚刚发现一个蛮好的 Rails 视频网站</title>
      <description>&lt;p&gt;&lt;a href="https://gorails.com" rel="nofollow" target="_blank"&gt;https://gorails.com&lt;/a&gt;&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Mon, 11 Apr 2016 22:49:18 +0800</pubDate>
      <link>https://ruby-china.org/topics/29668</link>
      <guid>https://ruby-china.org/topics/29668</guid>
    </item>
    <item>
      <title>大家有谁用过 simditor gem？</title>
      <description>&lt;p&gt;弱弱的问这个 Initialization 因该放在哪里？&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;editor = new Simditor(
  textarea: $('#editor')
  toolbar: [
    'title','bold','italic','underline','strikethrough','color','|'
    'ol','ul','blockquote','code','table','link','image','hr','|'
    'indent','outdent'
  ]
  pasteImage: true
  defaultImage: '&amp;lt;%= image_path "upload-loading.png" %&amp;gt;'
  upload: url: '/upload')
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;我放在 app/config/initializers 文件夹里会出错！&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Tue, 03 Nov 2015 23:33:03 +0800</pubDate>
      <link>https://ruby-china.org/topics/27937</link>
      <guid>https://ruby-china.org/topics/27937</guid>
    </item>
    <item>
      <title>升级到 OS X EI Capitan 又遇到一个问题</title>
      <description>&lt;p&gt;npm 的问题，无法安装包了；
&lt;code&gt;https://forums.developer.apple.com/thread/20866&lt;/code&gt;
大家有遇到过吗？&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Tue, 27 Oct 2015 11:40:38 +0800</pubDate>
      <link>https://ruby-china.org/topics/27838</link>
      <guid>https://ruby-china.org/topics/27838</guid>
    </item>
    <item>
      <title>大家 Mac 有升级到 OS X EI Capitan 吗？</title>
      <description>&lt;p&gt;我升级到 OS X EI Capitan，Oh my zsh 报错，&lt;code&gt;compdef: unknown command or service: git&lt;/code&gt; 搜了下貌似没找到解决方法；
各位有遇到这样的情况吗？&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Wed, 21 Oct 2015 17:20:16 +0800</pubDate>
      <link>https://ruby-china.org/topics/27773</link>
      <guid>https://ruby-china.org/topics/27773</guid>
    </item>
    <item>
      <title>最近用了一下 RubyMotion，一些使用心得</title>
      <description>&lt;p&gt;最近突然想学学 iOS 于是就选择了 RubyMotion。为什么不直接学 Swift，主要理由就是 Ruby 语言还没玩熟，避免用其他语言搞混；
零 iOS 经验，一些 Ruby 和 Rails 开发经验；学了 2 周，感觉用 RubyMotion 上手 iOS 还是很方便的；至于学习 RubyMotion 是否需要会 iOS 经验，我觉得不用；
这本书写的蛮好的可以先看下&lt;a href="https://www.packtpub.com/application-development/rubymotion-ios-development-essentials" rel="nofollow" target="_blank" title=""&gt;rubymotion-ios-development-essentials&lt;/a&gt;
遇到问题时在看下 iOS 的这本书 [Beginning iOS 6 Development Exploring the iOS] 基本上就入门了。&lt;/p&gt;

&lt;p&gt;目前心得如下：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;RubyMotion 是 Ruby 的变体（和 Ruby 还是有一点点不一样的）所以 Ruby 的 Gem 是不能用的；只能用特定的 Gem &lt;a href="http://motion-toolbox.com" rel="nofollow" target="_blank"&gt;http://motion-toolbox.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;RubyMotion 直接运行 OC Runtime 原则上速度和 OC、Swift 一样快; &lt;a href="http://www.rubymotion.com/developers/guides/manuals/cocoa/runtime" rel="nofollow" target="_blank" title=""&gt;RubyMotion 运行库&lt;/a&gt; ，&lt;a href="http://chunlea.logdown.com/posts/2013/09/26/rubymotion-runtime-runtime-guide" rel="nofollow" target="_blank" title=""&gt;中文翻译&lt;/a&gt;
&lt;img src="http://www.rubymotion.com/img/features/ios-runtime.png" title="" alt=""&gt;
&lt;/li&gt;
&lt;li&gt;UI 界面我选择直接手写，不用 xib 和 StroyBoard；理由是有了 Motion-kit 这个 Gem 在 Auto Layout 布局上还是非常方便的；&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://revealapp.com" rel="nofollow" target="_blank" title=""&gt;Reveal&lt;/a&gt;这个 App 一定要用，它好比 Chrome developer tool；特别是在学习 Auto Layout 布局的时候使用 Reveal 很容易理解；&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;以下是我学习的一些笔记，有点粗躁以后会更新；
&lt;a href="http://www.jianshu.com/p/df7fccd7d13f" rel="nofollow" target="_blank" title=""&gt;RubyMotion 学习记录&lt;/a&gt;
&lt;a href="http://www.jianshu.com/p/424a0de483c1" rel="nofollow" target="_blank" title=""&gt;Motion-kit 使用记录&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;搜集的一些学习资料，供参考（论坛其他大神发过的我就不重复发了）；
RubyMotion 资料
&lt;a href="http://rubymotion-tutorial.com" rel="nofollow" target="_blank"&gt;http://rubymotion-tutorial.com&lt;/a&gt;
&lt;a href="https://danielzhangqinglong.github.io/categories/Ruby-Motion" rel="nofollow" target="_blank"&gt;https://danielzhangqinglong.github.io/categories/Ruby-Motion&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;RubyMotion 视频
MotioninMotion 部分视频（我不知道在这里分享这视频是否合适，我也是在网上收集来的！）&lt;/p&gt;

&lt;p&gt;RubyMotion2014 开发者大会
链接：&lt;a href="http://pan.baidu.com/s/1jGH8nTO" rel="nofollow" target="_blank"&gt;http://pan.baidu.com/s/1jGH8nTO&lt;/a&gt; 密码：2ntg&lt;/p&gt;

&lt;p&gt;iOS 开发者的 Blog
&lt;a href="http://onevcat.com/#blog" rel="nofollow" target="_blank"&gt;http://onevcat.com/#blog&lt;/a&gt;
&lt;a href="http://www.90159.com" rel="nofollow" target="_blank"&gt;http://www.90159.com&lt;/a&gt;
&lt;a href="http://blog.cnbluebox.com/blog/2014/09/09/appkai-fa-zhe-xu-yao-wei-iphone6zuo-chu-gai-bian" rel="nofollow" target="_blank"&gt;http://blog.cnbluebox.com/blog/2014/09/09/appkai-fa-zhe-xu-yao-wei-iphone6zuo-chu-gai-bian&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;使用过 RubyMotion 的朋友们多多交流；&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Tue, 08 Sep 2015 16:38:52 +0800</pubDate>
      <link>https://ruby-china.org/topics/27239</link>
      <guid>https://ruby-china.org/topics/27239</guid>
    </item>
    <item>
      <title>还有没有伙伴还在玩 RubyMotion 的？</title>
      <description>&lt;p&gt;还有没有伙伴还在玩 Rubymotion 的？想交流下！&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Mon, 10 Aug 2015 17:03:07 +0800</pubDate>
      <link>https://ruby-china.org/topics/26856</link>
      <guid>https://ruby-china.org/topics/26856</guid>
    </item>
    <item>
      <title>去年北京的 RubyConf 大会视频没出来吗？</title>
      <description>&lt;p&gt;问一下！&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Mon, 05 Jan 2015 15:04:14 +0800</pubDate>
      <link>https://ruby-china.org/topics/23551</link>
      <guid>https://ruby-china.org/topics/23551</guid>
    </item>
    <item>
      <title>学习 Rails 后第一个作品完成！</title>
      <description>&lt;p&gt;项目名称是：Speshub 
Link：&lt;a href="http://www.speshub.com" rel="nofollow" target="_blank"&gt;http://www.speshub.com&lt;/a&gt;  测试登录帐号：shin.php@gmail.com 密码：123456
源码：&lt;a href="https://github.com/shin-ruby/speshub2" rel="nofollow" target="_blank"&gt;https://github.com/shin-ruby/speshub2&lt;/a&gt;  （代码写的不好，没有学习价值）&lt;/p&gt;

&lt;p&gt;先介绍下 Speshub，这项目是我入门 Rails 后想找个练手的项目实践，后来以 Airbnb 网站为思路，简化了功能，花了 N 个双休日设计、制作，虽然还有不少 bug 和功能可以更新，但这个项目暂告一段落，这一阶段的学习目标完成。&lt;/p&gt;

&lt;p&gt;学习 Rails 很不容易，虽然我有一点点的 PHP 知识，但那么先进 Framework 单单理念就花了很久了解，期间多次想放弃。
我学习路径是：买了第三版的《Agile Web Development Rails》看，看不懂，硬看，期间又买了 Ruby 锄头书看，还是看不懂；
问朋友，得到的回答是 30 岁了还看技术书干嘛。找 1 个会 Ruby 的人请教，完全听不懂技术高人的语言。最后还是只能自己静下心来学。后来发现了&lt;a href="/andor_chen" class="user-mention" title="@andor_chen"&gt;&lt;i&gt;@&lt;/i&gt;andor_chen&lt;/a&gt;翻译的《Ruby on Rails Tutorial》才慢慢搞明白的，特别感谢&lt;a href="/andor_chen" class="user-mention" title="@andor_chen"&gt;&lt;i&gt;@&lt;/i&gt;andor_chen&lt;/a&gt;，还有 RubyChina 社区和上海 RubyTuesday。&lt;/p&gt;

&lt;p&gt;我现在全职是在一家 Data center 公司从事 Marketing 工作，我学习 Web development 的目的是 1.兴趣；2.现在是互联网时代，会一些开发很有必要，会让你脱颖而出；&lt;/p&gt;

&lt;p&gt;接下去我的学习计划在仔细看下 Railscast，再提升下 Javascript 技术; 明年有机会我想转为全职 Rails 开发，很 Cool～&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Mon, 06 Oct 2014 10:12:00 +0800</pubDate>
      <link>https://ruby-china.org/topics/21875</link>
      <guid>https://ruby-china.org/topics/21875</guid>
    </item>
    <item>
      <title>关于建 User 表的问题</title>
      <description>&lt;p&gt;用 devise 建 User 表时，个人信息详细资料建在 User 表里，还是分离另一张表 has_one 呢，一般那种常用？&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Thu, 11 Sep 2014 16:38:15 +0800</pubDate>
      <link>https://ruby-china.org/topics/21481</link>
      <guid>https://ruby-china.org/topics/21481</guid>
    </item>
    <item>
      <title>程序要天天写啊！一个月没写代码忘了差不多了！</title>
      <description>&lt;p&gt;感叹一下！&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Mon, 01 Sep 2014 16:53:31 +0800</pubDate>
      <link>https://ruby-china.org/topics/21330</link>
      <guid>https://ruby-china.org/topics/21330</guid>
    </item>
    <item>
      <title>项目部署 production 遇到一个问题，请教！</title>
      <description>&lt;p&gt;在 development 运行良好，今天在&lt;code&gt;RAILS_ENV=production rake db:create db:migrate&lt;/code&gt;时报错&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;== 20140623055658 AddRentEnvToSearches: migrating =============================
-- add_column(:searches, :rent_env_id, :integer)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: no such table: searches: ALTER TABLE "searches" ADD "rent_env_id" integer
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;是这个迁移文件没找到吗？&lt;/p&gt;

&lt;p&gt;不知道问题点出在哪里？请教大家！&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Wed, 16 Jul 2014 22:53:20 +0800</pubDate>
      <link>https://ruby-china.org/topics/20528</link>
      <guid>https://ruby-china.org/topics/20528</guid>
    </item>
    <item>
      <title>有个网站项目</title>
      <description>&lt;p&gt;群里的朋友帮忙推荐几个靠谱的网站制作公司，最好在上海有 office！
有个房地产网站项目，对前端要求比较高，最好有做过房地产网站的案例。价格不是问题 5w+ 10w，客户是一家外资背景的公司，Boss 很 nice 很靠谱。
本人之前也做网站制作项目，但因其他原因今年开始不接活了！so 我会帮忙推荐，不收取任何费用！&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Thu, 05 Jun 2014 10:30:48 +0800</pubDate>
      <link>https://ruby-china.org/topics/19752</link>
      <guid>https://ruby-china.org/topics/19752</guid>
    </item>
    <item>
      <title>好可爱！</title>
      <description>&lt;p&gt;Ruby &lt;/p&gt;

&lt;p&gt;由松本爸爸养大的日本的女孩子。因为生日在圣诞节，人生最大的烦恼是生日礼物和圣诞节礼物变成一份了。出生地是岛根县松江市，除了旅游和工作以外没有到过其它的县。 &lt;/p&gt;

&lt;p&gt;由于受的教育是自由奔放式的，她性格好动、好奇心旺盛。平时是一个率真的好孩子，但偶尔也会看到她喜欢恶作剧的一面，这让周围的人十分困扰。看到她的身影时经常会想起 IT 业的“Just For Fun !”这句话。 &lt;/p&gt;

&lt;p&gt;小时候过着一个人在荒山野岭到处跑的生活，10 岁的时候与一个叫 Rails 的女孩成为朋友，生活开始变化。两个人玩耍时停在了演艺事务所门前，谈起可以两个人结对进行演艺活动。以“Ruby 与 Rails”的艺名出道、主要从事杂志模特，也有拍过电视广告，所以很多人都听过她们名字。 &lt;/p&gt;

&lt;p&gt;&lt;img src="http://dl2.iteye.com/upload/attachment/0095/1147/1020c6bb-c1d7-32d3-9fac-1c07a943f920.jpg" title="" alt="Ruby"&gt;&lt;/p&gt;

&lt;p&gt;人们想着她在这多愁善感的年龄段体验各种演艺活动、性格多少会产生一些变化吧，但在前些天与她久违的谈话中，却惊讶地发现她仍是与从事演艺活动之前一样行动自由奔放。虽然行为举止多多少少显得更加稳重，其喜欢恶作剧、活泼的本性却和以前一样没有变化。 &lt;/p&gt;

&lt;p&gt;想着已经是高中生了差不多也要开始穿一些成熟一点的服装的她，对于洋装却和小时候一样穿着 Mickey Mouse。虽然她个子小又是娃娃脸与这样的衣服很配，不过这样真像一个女高中生吗？ &lt;/p&gt;

&lt;p&gt;她的粉丝也分为想要她一直保持现在的样子，和想要看到她更成熟的样子的两派。 &lt;/p&gt;

&lt;p&gt;更多&lt;a href="http://www.iteye.com/news/28883" rel="nofollow" target="_blank"&gt;http://www.iteye.com/news/28883&lt;/a&gt;&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Thu, 20 Mar 2014 16:30:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/18042</link>
      <guid>https://ruby-china.org/topics/18042</guid>
    </item>
    <item>
      <title>遇到一个测试问题</title>
      <description>&lt;p&gt;测试 space.rb 的 modle 时&lt;/p&gt;

&lt;p&gt;在 space_pages_spec.rb 代码如下&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;describe "show space page" do
  before do
    @space = Space.create(
    space_setting:  "1",
    user_group:     "1",
    rent_env:       "1",
    num_of_people:  "1",
    city:           "上海",
    title:          "你好杨浦",
    content:        "五角场商圈",
    photo:          "wujiaochang.jpg",
    detailed:       "1,2,3,4,6,7")
    visit space_path(@space)
  end
  it { should have_selector('h3', text: space.title)}
  it { should have_selector('h4', text: space.city)}
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;报错如下
Failures:
  1) SpacePages show space page 
     Failure/Error: visit space_path(&lt;a href="/space" class="user-mention" title="@space"&gt;&lt;i&gt;@&lt;/i&gt;space&lt;/a&gt;)
     ActiveRecord::RecordNotFound:
       Couldn't find SpaceSetting with id=1
     # ./app/controllers/spaces_controller.rb:10:in &lt;code&gt;show'
     # ./spec/requests/space_pages_spec.rb:30:in&lt;/code&gt;block (3 levels) in '&lt;/p&gt;

&lt;p&gt;2) SpacePages show space page 
     Failure/Error: visit space_path(&lt;a href="/space" class="user-mention" title="@space"&gt;&lt;i&gt;@&lt;/i&gt;space&lt;/a&gt;)
     ActiveRecord::RecordNotFound:
       Couldn't find SpaceSetting with id=1
     # ./app/controllers/spaces_controller.rb:10:in &lt;code&gt;show'
     # ./spec/requests/space_pages_spec.rb:30:in&lt;/code&gt;block (3 levels) in '&lt;/p&gt;

&lt;p&gt;Finished in 0.25858 seconds
4 examples, 2 failures&lt;/p&gt;

&lt;p&gt;为什么会找不到 id=1 的 SpaceSetting 呢？&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Tue, 14 Jan 2014 13:36:46 +0800</pubDate>
      <link>https://ruby-china.org/topics/16787</link>
      <guid>https://ruby-china.org/topics/16787</guid>
    </item>
    <item>
      <title>看到一遍不错的帖子，分享一下！</title>
      <description>&lt;p&gt;&lt;a href="http://www.zeali.net/zpages/gowest.htm#GoWest_Charpter_15" rel="nofollow" target="_blank"&gt;http://www.zeali.net/zpages/gowest.htm#GoWest_Charpter_15&lt;/a&gt;&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Fri, 15 Nov 2013 17:06:28 +0800</pubDate>
      <link>https://ruby-china.org/topics/15570</link>
      <guid>https://ruby-china.org/topics/15570</guid>
    </item>
    <item>
      <title>请教,bootstrap 里有没有让 DIV 悬浮在浏览器底部的功能？</title>
      <description>&lt;p&gt;正在用 bootstrap 3 做个页面需要用到这个功能，或者有没有什么比较好的插件推荐！谢谢～&lt;/p&gt;</description>
      <author>shin</author>
      <pubDate>Mon, 09 Sep 2013 17:25:12 +0800</pubDate>
      <link>https://ruby-china.org/topics/13989</link>
      <guid>https://ruby-china.org/topics/13989</guid>
    </item>
  </channel>
</rss>
