<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dylan Lin on Medium]]></title>
        <description><![CDATA[Stories by Dylan Lin on Medium]]></description>
        <link>https://medium.com/@dylan0203?source=rss-3d11617de5e0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BFy6SclRo0gJRE_mipExEQ.jpeg</url>
            <title>Stories by Dylan Lin on Medium</title>
            <link>https://medium.com/@dylan0203?source=rss-3d11617de5e0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 17:25:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dylan0203/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Gist or Medium?]]></title>
            <link>https://medium.com/@dylan0203/gist-or-medium-9756e22ef552?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9756e22ef552</guid>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Wed, 12 Apr 2017 16:48:05 GMT</pubDate>
            <atom:updated>2017-04-12T16:49:47.359Z</atom:updated>
            <content:encoded><![CDATA[<p>Float::INFINITY 寫判斷式應該要用更合乎語意與狀態的表達方式。</p><p>我想應該還是要用ＧＩＳＴ來寫有關程式相關的東西。</p><ul><li>** Markdown 要練習一下，所以就不在這寫了～掰～</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9756e22ef552" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[gem install eventmachine -v ‘1.0.8’]]></title>
            <link>https://medium.com/@dylan0203/gem-install-eventmachine-v-1-0-8-34c179b4cf3e?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/34c179b4cf3e</guid>
            <category><![CDATA[eventmachine]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[rails]]></category>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Wed, 02 Mar 2016 01:48:18 GMT</pubDate>
            <atom:updated>2016-03-02T01:48:18.823Z</atom:updated>
            <content:encoded><![CDATA[<p>gem install eventmachine -v ‘1.0.8’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*npBXkVljAa1uajQDfLRDJA.png" /></figure><p>這個東西裝不起來，好像是因為新的作業系統的關係<br>因為就算跑了最下面壹行也過不了</p><p>我還以為是因為最新版ruby的關係，<br>害我裝了三四版的ruby，然後又在每個ruby下面裝了一堆gem~&quot;~</p><p>一行指令就好了：</p><p>brew link openssl — force</p><p>之後再bundle，收工</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34c179b4cf3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Devise confirmable by Mailgun — Rails Setting]]></title>
            <link>https://medium.com/@dylan0203/devise-confirmable-by-mailgun-rails-setting-4e60229b090?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e60229b090</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[mailgun]]></category>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Thu, 18 Feb 2016 10:54:26 GMT</pubDate>
            <atom:updated>2016-02-18T10:56:25.983Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@dylan0203/mailgun-with-namecheap-domain-verification-dns-%E8%B8%A9%E9%9B%B7%E7%AD%86%E8%A8%98-dcf4bf9c7d41">設定好Mailgun跟你的dns之後</a>，我要讓新的註冊者從信箱認證。</p><p>照之前ihower的說法，因為希望讓使用者可以馬上使用，先不要開啟認證的機制。<br>因為我也裝了讓使用者可以fb註冊登入，所以這邊就有安全疑慮的問題</p><p>有心人可以先註冊你的email信箱，之後你再用fb註冊登入，你得到的身分會直接寫到之前已經註冊好的這個相同的email底下，而有心人在此時就與你共用同一個帳號了呦～你有啥權限他就有啥權限。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*vXwGubQUmSFgKf3EBe3yZQ.png" /><figcaption>:confirmable打開（右上角那個）</figcaption></figure><p>首先在models/user.rb 的設定把 :confirmable打開（加進去）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ZZu9Z3GyKoigj7peUXIXEg.png" /><figcaption>config/environment/production.rb</figcaption></figure><p>79行- 設定domain，這樣信箱裡面的連結才是絕對網址<br>80行- 用:smtp方式寄信<br>81行- 因為我用公開github帳號，所以我不想把設定檔推上去這樣api私鑰都被看光光所以讓他專門去讀取一支我不讓他上傳的檔案，之後再手動加到server上。<a href="https://ihower.tw/rails4/actionmailer.html">而symbolize_keys這個方法會將Hash中的String key換成Symbol key，這是因為smtp_settings吃的是Symbol key，如果沒有轉的話，會讀不到設定。</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*toolrtHViuY5Yo8fc2PXbg.png" /><figcaption>config/email.yml</figcaption></figure><p>開一個新檔，email.yml在config下</p><p>把mailgun給你的資料塞進去，沒有給你的就照上面輸入<br>第2行跟第11行- 的api_key，之後可以讓你在ActionMailer去用api寄信，但是<a href="https://github.com/mailgun/mailgun-ruby">前提是你要先裝官方的gem才可以叫</a>～</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*nwS41yauyo9OJkwjUrbRRw.png" /><figcaption>.gitignore</figcaption></figure><p>記得在ignore list裡加上email.yml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-RkjT5vzCpZ0yZrVFPrWQA.png" /><figcaption>config/deploy.rb</figcaption></figure><p>在config/deploy.rb裡設定剛剛不傳上github，所以要去server上share資料夾讀取的檔案</p><p>set :linked_files, fetch(:linked_files, []).push(‘config/database.yml’, ‘config/secrets.yml’, ‘config/facebook.yml’, ‘config/rollbar.yml’, ‘config/email.yml’)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*6ilESzgiC36FcPdjrtuS_g.png" /><figcaption>project/shared/config/</figcaption></figure><p>手動補上email.yml<br>這樣每次部時都會自動來這讀鑰匙了</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*eSVHn3qm3yjDoc8cvPUCvg.png" /></figure><p>佈署好之後就可以來註冊測試一下～</p><p>打完收工！</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e60229b090" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mailgun with Namecheap — Domain Verification & DNS 踩雷筆記]]></title>
            <link>https://medium.com/@dylan0203/mailgun-with-namecheap-domain-verification-dns-%E8%B8%A9%E9%9B%B7%E7%AD%86%E8%A8%98-dcf4bf9c7d41?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcf4bf9c7d41</guid>
            <category><![CDATA[namecheap]]></category>
            <category><![CDATA[mailgun]]></category>
            <category><![CDATA[rails-4]]></category>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Mon, 15 Feb 2016 06:29:27 GMT</pubDate>
            <atom:updated>2016-02-18T06:45:57.898Z</atom:updated>
            <content:encoded><![CDATA[<p>事情往往不是憨人想得那麼簡單，<br>就算有step by step 讓你copy＆past，<br>還是可以讓你踩得開心、踩得愉快～<br>無論是屎還是雷Orz</p><p><a href="https://julienliabeuf.com/mailgun-namecheap-spf-dkim-validation/">參考文章：MailGun and NameCheap: SPF and DKIM Validation</a></p><p>那我們就來囉～</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/263/1*xkbvgEGuL68ISV9Fajlrbw.jpeg" /><figcaption>一開始需要加入domain</figcaption></figure><p>mailgun建議使用sub domain，<a href="https://help.mailgun.com/hc/en-us/articles/203357040-Can-I-use-the-same-domain-name-for-Mailgun-and-for-Google-Apps-or-another-email-server-">這樣原本的domain才可以繼續收信</a><br>而我的專案剛好就是設在sub domain下面所以就直接來來用了</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fCo0qdD1pQ9Ni4TWUlrMnA.jpeg" /><figcaption>示範一下</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n2duF14HSL8nKRo9hG7uSA.jpeg" /><figcaption>這裡讓我卡了五個小時……</figcaption></figure><p>先到namecheap～</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OLvw2yHCdiS3_T4JO-Ix1Q.jpeg" /><figcaption>選到sub domain設定去</figcaption></figure><p>Domain List 然後再選sub domain去設定，當然前提是你要先把sub domain設定好設定滿才有得選啦</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8YbC9FEo8woUDJuPWmvj4Q.jpeg" /></figure><p>然後選Advanced DNS，這邊先設定三個：一個CNAME、兩個TXT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rQGMqYhnr44XAMzm_Cw7vw.jpeg" /></figure><p>再來設定兩個，先在Mail Setting這邊選到Custom MX</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rlpAbCGRcNU7vbw9fPnZ0w.jpeg" /></figure><p>然後填入兩個MX Record設定，旁邊的 <a href="https://zh.wikipedia.org/wiki/%E5%AD%98%E6%B4%BB%E6%99%82%E9%96%93">TTL</a> 我都暫設為1分鐘，為了是趕快生效看測試結果，之後我就全部改回automatic了喔～</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UTcz1vhf43-MC11uiNSN8Q.jpeg" /></figure><p>來一下對照圖，左邊是要求我複製貼上的，右邊為我的正確解答=.=</p><p>來整理一下：<br>1. sub domain都不用填，改為＠或是email取代<br>2. 重點！！圖中正方形框起來的是要自己輸入的，除了mailgun要求的value之外，要再最前面加上</p><blockquote><strong><em>v=DKIM1;</em></strong></blockquote><p>掯！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*btbBMNE5VwsRHLHgKlHSxg.jpeg" /></figure><p>然後就可以過關了............</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcf4bf9c7d41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rollbar Setting — Rails: 4.2.5 with Capistrano on Linode]]></title>
            <link>https://medium.com/@dylan0203/rollbar-setting-rails-4-2-5-with-capistrano-on-linode-7263a9ec6958?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7263a9ec6958</guid>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[alphacamp]]></category>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Tue, 02 Feb 2016 16:56:26 GMT</pubDate>
            <atom:updated>2016-02-02T16:56:26.572Z</atom:updated>
            <content:encoded><![CDATA[<p>Rollbar Setting — Rails: 4.2.5 with Capistrano on Linode</p><p>Rollbar是一個輕量使用時是免費的報錯通知工具，所以我選這個來裝～</p><p>想說很簡單，但是還是被我找到雷來踩～</p><p><a href="https://rollbar.com/?dr">https://rollbar.com</a>/</p><p>照著申請完帳號之後</p><p>按照步驟裝也會報錯，但滿幸運的被我找到問題，然後用力抓出來了掯。<br>害我亂commit一堆=.=算了反正我的repositry早就醜爆.</p><pre>gem &#39;rollbar&#39;, &#39;~&gt; 2.7.1&#39;</pre><pre>bundle install<br>rails generate rollbar POST_SERVER_ITEM_ACCESS_TOKEN<br>                             上面這行放他給你的token<br>                               如果是私人repositry的話沒差直接放<br>                                 但是如果是公開的話雖然我不知道<br>                                   可以怎麼被利用但是就另外擺比較保險八<br>rails generate rollbar<br>export ROLLBAR_ACCESS_TOKEN=POST_SERVER_ITEM_ACCESS_TOKEN<br>                            直接貼上token喊一下因為下一行要測試<br>rake rollbar:test<br>     然後就會寄測試信到你的信箱了～</pre><p>雷來了～</p><pre>require &#39;rollbar/capistrano3&#39; <br>上面這行他要求你擺進Capfile的這個東西<br>請擺在 require &#39;capistrano/deploy&#39;下面不然你就一直cap abort八</pre><p>cap aborted!<br>Don’t know how to build task ‘deploy:finished’<br>/Users/superjamess/Projects/Crowdy-Stori/Capfile:4:in `&lt;top (required)&gt;’<br>LoadError: cannot load such file — rollbar/capistrano3<br>/Users/superjamess/Projects/Crowdy-Stori/Capfile:4:in `&lt;top (required)&gt;’</p><p>上面就是林北的報錯訊息，只是個先後順序就讓我刪掉又裝裝掉又刪.....</p><p>接下來在deploy.rb裡面加上</p><pre>set :rollbar_token, ENV[&#39;ROLLBAR_ACCESS_TOKEN&#39;]&lt;--私人直接貼token收工<br>set :rollbar_env, Proc.new { fetch :stage }<br>set :rollbar_role, Proc.new { :app }</pre><p>用公開repository的就分開擺放：</p><p>同樣deploy.rb</p><p>set :linked_files, fetch(:linked_files, []).push(‘config/database.yml’, ‘config/secrets.yml’, ‘config/facebook.yml’, ‘config/rollbar.yml’)</p><p>像上方一樣最多加上一個 rollbar.yml 讓app去抓server上的檔案</p><p>然後config資料夾當然就是放這個檔案</p><p>ROLLBAR_ACCESS_TOKEN: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</p><p>裡面放上面這行xxx當然就是你的token記得換掉</p><p>相同的檔案記得也放一份在server上shared/config資料夾裡面</p><p>然後記得！！！！！！</p><p>.gitignore要加上 /config/rollbar.yml</p><p>不然也把密碼推上去，那分開放就沒有意義只剩義氣了.....</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7263a9ec6958" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[照片上傳後顯示的方向不正確 — Ruby on Rails]]></title>
            <link>https://medium.com/@dylan0203/%E7%85%A7%E7%89%87%E4%B8%8A%E5%82%B3%E5%BE%8C%E9%A1%AF%E7%A4%BA%E7%9A%84%E6%96%B9%E5%90%91%E4%B8%8D%E6%AD%A3%E7%A2%BA-ruby-on-rails-cd4b84cdab0c?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd4b84cdab0c</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[alphacamp]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Tue, 02 Feb 2016 07:38:41 GMT</pubDate>
            <atom:updated>2016-02-02T07:50:05.134Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>照片上傳後顯示的方向不正確 — Ruby on Rails</blockquote><p>其實現在的照片在自己的頭上都有exif資訊</p><p>所以可以利用這個資料來調整顯示的方向</p><p>在app/uploaders/avatar_uploader.rb裡加上</p><pre>def fix_exif_rotation<br>  manipulate! do |img|<br>    img.tap(&amp;:auto_orient)<br>  end<br>end</pre><pre>process :fix_exif_rotation</pre><pre><a href="https://github.com/Dylan0203/Crowdy-Stori/commit/98458c47a03cd719601c98151ea992fec128d1f3">連結點我</a></pre><p>重點其實就是上傳時候先讀exif然後旋轉他….</p><p>寫好方法然後執行，就將子～</p><p>天啊，alphacamp真的很操～</p><p>完完全全沒有時間寫blog、晚上的跑步也都取消、</p><p>因為我平均都留到快十一點才離開，不是cs背景真的讓自己很緊張學不好～</p><p>但我相信我稱過來了，而且學到很多，雖然要學得還更多。</p><p>別誤會，沒有人會逼～</p><p>壓力是自己給自己的～</p><p>沒有決心的人可以去資策會～</p><p>我會說很操的原因是每天都會被很多很有用的資訊炸～</p><p>上課憋尿怕漏聽是很常有的事情～</p><p>同材在旁邊進步也是個個正向的壓力在督促你加把勁！！</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd4b84cdab0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week5 day5 med-term]]></title>
            <link>https://medium.com/@dylan0203/week5-day5-med-term-ae4b1e64d7c8?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae4b1e64d7c8</guid>
            <category><![CDATA[alphacamp]]></category>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Sat, 26 Dec 2015 07:56:03 GMT</pubDate>
            <atom:updated>2015-12-26T07:57:14.170Z</atom:updated>
            <content:encoded><![CDATA[<p>下午兩點開始考試，寫到八點是怎樣，這週週間外務太多了，<br>週四討論final project的方向，結果連主旨都改了Orz<br>早上上課時偷偷研究一下ajax的送出function，<br>拿了前一天muki才丟出來的半成品修改function來參考<br>運氣好的被我蝦弄改出來可以送出成功，<br>考試的時候基本上就是複製貼上了O_O</p><p>好險有把這個東西弄出來然後分享給大家，<br>所以五點大家都搞定要走的時候申請了alex與tony救援牌，<br>兩人幫我瞬間解惑把功能弄出來。<br>因為作業也只做一半功能而已。</p><p>另外，改了主旨的Final，讓週四下午的tech review白做了，<br>要重新詢問ihower大大，因為user story會大改呀.....<br>時間利用與學習效率真的是超級重要的課題...</p><p>好想去時光屋慢慢修煉喔.....</p><p>好了我要回去刻我落後的第五週作業:論壇了....</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae4b1e64d7c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[好用工具集]]></title>
            <link>https://medium.com/@dylan0203/%E5%A5%BD%E7%94%A8%E5%B7%A5%E5%85%B7%E9%9B%86-92e4450d5489?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/92e4450d5489</guid>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Wed, 23 Dec 2015 17:33:27 GMT</pubDate>
            <atom:updated>2016-01-01T10:45:38.919Z</atom:updated>
            <content:encoded><![CDATA[<p>好用工具集</p><p><a href="http://sql.marsz.tw/">http://sql.marsz.tw/</a> ←讓你畫Database關連</p><p><a href="https://sunilsharma3639.wordpress.com/2014/01/18/draw-architectural-design-of-the-project-using-railroady-gem/">https://sunilsharma3639.wordpress.com/2014/01/18/draw-architectural-design-of-the-project-using-railroady-gem/</a> ←幫你畫Database關連</p><p><a href="https://coolors.co/browser">https://coolors.co/browser</a> ←網站配色</p><p><a href="http://kenwheeler.github.io/slick/">http://kenwheeler.github.io/slick/</a> ←Slides</p><p><a href="http://www.appelsiini.net/projects/lazyload">http://www.appelsiini.net/projects/lazyload</a> ← Lazy Load</p><h4><a href="http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/create_table#227-All-methods">All methods</a></h4><h3><a href="http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/create_table">create_table</a> :table do |t|</h3><pre>t<strong>.</strong>column <em># adds an ordinary column. Ex: t.column(:name, :string)</em><br>  t<strong>.</strong>index <em># adds a new index.</em><br>  t<strong>.</strong>timestamps<br>  t<strong>.</strong>change <em># changes the column definition. Ex: t.change(:name, :string, :limit =&gt; 80)</em><br>  t<strong>.</strong>change_default <em># changes the column default value.</em><br>  t<strong>.</strong>rename <em># changes the name of the column.</em><br>  t<strong>.</strong>references<br>  t<strong>.</strong>belongs_to<br>  t<strong>.</strong>string<br>  t<strong>.</strong>text<br>  t<strong>.</strong>integer<br>  t<strong>.</strong>float<br>  t<strong>.</strong>decimal<br>  t<strong>.</strong>datetime<br>  t<strong>.</strong>timestamp<br>  t<strong>.</strong>time<br>  t<strong>.</strong>date<br>  t<strong>.</strong>binary<br>  t<strong>.</strong>boolean<br>  t<strong>.</strong>remove<br>  t<strong>.</strong>remove_references<br>  t<strong>.</strong><a href="http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/remove_belongs_to">remove_belongs_to</a><br>  t<strong>.</strong><a href="http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/remove_index">remove_index</a><br>  t<strong>.</strong><a href="http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/remove_timestamps">remove_timestamps</a><br><strong>end</strong></pre><p>.try(:updated_at).try(:to_s, :short) ←用了try給時間又要把它弄短！</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92e4450d5489" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week5 Day3 Assigement-Forum 作業筆記2]]></title>
            <link>https://medium.com/@dylan0203/week5-day3-assigement-forum-%E4%BD%9C%E6%A5%AD%E7%AD%86%E8%A8%982-a3e282f2f946?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3e282f2f946</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[alphacamp]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Wed, 23 Dec 2015 17:23:34 GMT</pubDate>
            <atom:updated>2015-12-23T17:23:34.194Z</atom:updated>
            <content:encoded><![CDATA[<p>參考資料：<a href="https://ihower.tw/rails4/activerecord.html">ActiveRecord — 基本操作與關聯設計</a></p><p>Category 多對多to Article</p><p>rails g model category name:string<br>rails g model article_categoryship article_id:integer category_id:integer</p><p>rake db:migrate</p><blockquote>class Article &lt; ActiveRecord::Base</blockquote><blockquote>validates_presence_of :topic</blockquote><blockquote>has_many :article_categoryships</blockquote><blockquote>has_many :categoeies, :through =&gt; :article_categoryships</blockquote><blockquote>end</blockquote><blockquote>class Category &lt; ActiveRecord::Base</blockquote><blockquote>has_many :article_categoryships</blockquote><blockquote>has_many :articles, :through =&gt; :article_categoryships</blockquote><blockquote>end</blockquote><blockquote>class ArticleCategoryship &lt; ActiveRecord::Base</blockquote><blockquote>belongs_to :article</blockquote><blockquote>belongs_to :category</blockquote><blockquote>end</blockquote><p>這禮拜已經發生兩次table莫名消失，消極解決方案就是</p><p>rake db:drop --&gt; db:create --&gt; db:migrate</p><p>然後一切就恢復正常，無解，國外也有許多table消失的例子</p><p>真的，沒空去追根究柢這個項目，六日沒看書真的進度很落後。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3e282f2f946" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week5 Day3 Assigement-Forum 作業筆記。]]></title>
            <link>https://medium.com/@dylan0203/week5-day3-assigement-forum-%E4%BD%9C%E6%A5%AD%E7%AD%86%E8%A8%98-7808873049d7?source=rss-3d11617de5e0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7808873049d7</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[alphacamp]]></category>
            <dc:creator><![CDATA[Dylan Lin]]></dc:creator>
            <pubDate>Wed, 23 Dec 2015 14:39:17 GMT</pubDate>
            <atom:updated>2015-12-23T14:40:46.786Z</atom:updated>
            <content:encoded><![CDATA[<p>參考資料：<a href="https://ihower.tw/rails4/firststep.html">rails 起步走</a>、<a href="https://ihower.tw/rails4/heroku.html">heroku佈署</a></p><pre>rails new Forum --skip-test-unit</pre><p>準備第一次push<br>git init <br>git add . <br>git cm -m “first push”</p><pre>git remote add origin git@github.com:Dylan0203/Forum.git<br>git push -u origin master</pre><p>rails s ←跑本地server <br><a href="http://localhost:3000/">http://localhost:3000/</a> ←本地瀏覽器</p><p>Gemfile:</p><p>增加 ←因為要上到Heroku所以要用PostgreSQL的database adapter<br>gem ‘pg’, group: :production<br>gem ‘rails_12factor’, group: :production</p><p>移動<br>gem ‘sqlite3’ 至下方開發環境和TEST才使用</p><p>bundle ← 安裝Gem</p><p>config/database.yml 的 production 改用 postgresql adapter:</p><pre>production:<br>   adapter: postgresql<br>   encoding: unicode</pre><p>heroku create<br>git push heroic master</p><p>ps: heroku run rake db:migrate ← 如果有更改表單在push完都要重整table<br> heroku restart ← 重開server</p><pre>bin/rake db:create ←建立資料庫</pre><p>參考資料：<a href="https://ihower.tw/rails4/basic.html">手工打造 CRUD 應用程式</a></p><pre>rails g model article topic:string content:text is_public:boolean user_id:integer &lt;-- for the user table as the foreign key</pre><p>rake db:migrate</p><p>到models改article.rb</p><pre>validates_presence_of :topic</pre><p>rails g controller articles</p><p>RESTful路由: 至routes.rb 加上 resources :articles</p><p>add index.html.erb at view/atricles</p><p>app/controllers/articles_controller.rb</p><p>建立new、show、edit、_form .html.erb at view</p><p><strong>發現寫不完，先掠過</strong></p><p>參考資料：<a href="https://ihower.tw/rails4/auth.html">使用者認證</a></p><p>Gemfile:<br>gem ‘devise’<br>輸入bundle install安裝此套件<br>輸入rails g devise:install產生devise設定檔</p><p>編輯 config/environments/development.rb 和 production.rb 加入寄信時預設的網站網址：<br>config.action_mailer.default_url_options = { host: ‘localhost’, port: 3000 }</p><p>到app/views/layouts/application.html.erb加上：<br> &lt;p class=”notice”&gt;&lt;%= notice %&gt;&lt;/p&gt;<br>&lt;p class=”alert”&gt;&lt;%= alert %&gt;&lt;/p&gt;</p><p>rails g devise:views<br>rails g devise user<br>rake db:mygrate</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7808873049d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>