<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6133568978917856400</id><updated>2015-12-21T10:02:50.565-08:00</updated><category term="Rails"/><category term="Ruby"/><category term="ActionDispatcher"/><category term="ActionMailer"/><category term="ActiveModel"/><category term="ActiveRecord"/><category term="ActiveRelation"/><category term="ActiveReload"/><category term="AssetPipeline"/><category term="Bundler"/><category term="CarrierWave"/><category term="Couchdb Ubuntu xulrunner"/><category term="Database"/><category term="Deployment"/><category term="Erubius"/><category term="Explain"/><category term="FLOAT"/><category term="File Upload"/><category term="MySQL"/><category term="Passenger"/><category term="Precision"/><category term="Processing"/><category term="Rack IOS Iphone Home Screen rack_iphone"/><category term="Rails Documentation"/><category term="Rails2.3+"/><category term="Rails3+"/><category term="Template Inheritance"/><category term="nginx"/><title type='text'>And ..... Viren </title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-1365842949190387615</id><published>2015-10-29T23:45:00.001-07:00</published><updated>2015-10-29T23:45:42.195-07:00</updated><title type='text'>IRB.start equivalent in Python</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Well, If anytime you wish to use the&amp;nbsp;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #0086b3; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.9px; line-height: 1.45;&quot;&gt;IRB&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.9px; line-height: 1.45;&quot;&gt;.start&lt;/span&gt;&amp;nbsp;like feature of Ruby in Python.&lt;br /&gt;&lt;br /&gt;They way to do it is.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.9px; font-stretch: normal; line-height: 1.45; overflow: auto; padding: 16px; word-break: normal; word-wrap: normal;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;import&lt;/span&gt; code&lt;br /&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;import&lt;/span&gt; readline&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;vars&lt;/span&gt; &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;globals&lt;/span&gt;() &lt;span class=&quot;pl-c&quot; style=&quot;box-sizing: border-box; color: #969896;&quot;&gt;## important to carry over the methods and variable define in program to shell&lt;/span&gt;&lt;br /&gt;shell &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;=&lt;/span&gt; code.InteractiveConsole(&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;vars&lt;/span&gt;)&lt;br /&gt;shell.interact()&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/1365842949190387615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2015/10/irbstart-equivalent-in-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/1365842949190387615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/1365842949190387615'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2015/10/irbstart-equivalent-in-python.html' title='IRB.start equivalent in Python'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-8103729381494507422</id><published>2015-07-02T00:34:00.001-07:00</published><updated>2015-10-07T06:48:37.254-07:00</updated><title type='text'>Some Ruby Thing </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;The following post consist of some features in ruby that are lesser known to people.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;1. &lt;b&gt;alias &lt;/b&gt;for &#39;&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #a71d5d; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;call&lt;/span&gt;&#39;&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45; overflow: auto; padding: 16px; word-break: normal; word-wrap: normal;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;pl-en&quot; style=&quot;box-sizing: border-box; color: #795da3;&quot;&gt;Ticket&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;pl-en&quot; style=&quot;box-sizing: border-box; color: #795da3;&quot;&gt;purchase&lt;/span&gt;&lt;br /&gt;    puts &lt;span class=&quot;pl-s1&quot; style=&quot;box-sizing: border-box; color: #df5000;&quot;&gt;&lt;span class=&quot;pl-pds&quot; style=&quot;box-sizing: border-box;&quot;&gt;&quot;&lt;/span&gt;** Purchasing the Ticket **&lt;span class=&quot;pl-pds&quot; style=&quot;box-sizing: border-box;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;end&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;alias_method&lt;/span&gt; &lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;:call&lt;/span&gt;,&lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;:purchase&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;pl-c&quot; style=&quot;box-sizing: border-box; color: #969896;&quot;&gt;## Following are they way you can invoke the download method&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;pl-s3&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;Ticket&lt;/span&gt;.&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;new&lt;/span&gt;.purchase&lt;br /&gt;&lt;span class=&quot;pl-c&quot; style=&quot;box-sizing: border-box; color: #969896;&quot;&gt;## =&amp;gt; ** Purchasing the Ticket **&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;pl-s3&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;A&lt;/span&gt;.&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;new&lt;/span&gt;.call&lt;br /&gt;&lt;span class=&quot;pl-c&quot; style=&quot;box-sizing: border-box; color: #969896;&quot;&gt;## =&amp;gt; ** Purchasing the Ticket **&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;pl-s3&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;A&lt;/span&gt;.&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;new&lt;/span&gt;.()&lt;br /&gt;&lt;span class=&quot;pl-c&quot; style=&quot;box-sizing: border-box; color: #969896;&quot;&gt;## =&amp;gt; ** Purchasing the Ticket **&lt;/span&gt;&lt;/pre&gt;&lt;b style=&quot;color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 17.2549991607666px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;2. &amp;nbsp;Disabling (&lt;b&gt;SSL&lt;/b&gt;) Certificate Check from all Gems or Ruby Libraries.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45; overflow: auto; padding: 16px; word-break: normal; word-wrap: normal;&quot;&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;pl-s3&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;Rails&lt;/span&gt;.env.production?&lt;br /&gt;  &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;pl-en&quot; style=&quot;box-sizing: border-box; color: #795da3;&quot;&gt;Net::HTTP&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;pl-en&quot; style=&quot;box-sizing: border-box; color: #795da3;&quot;&gt;verify_mode=&lt;/span&gt;(&lt;span class=&quot;pl-vpf&quot; style=&quot;box-sizing: border-box;&quot;&gt;verify_mode&lt;/span&gt;)&lt;br /&gt;      &lt;span class=&quot;pl-vo&quot; style=&quot;box-sizing: border-box;&quot;&gt;@verify_mode&lt;/span&gt; &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-s3&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;OpenSSL::SSL::VERIFY_NONE&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;end&lt;/span&gt;  &lt;/pre&gt;&lt;br /&gt;Note:&lt;br /&gt;&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Do this only on your local or development environment.&lt;/li&gt;&lt;li&gt;Also the above code only work if the libraries or gem uses&amp;nbsp;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;pl-s3&quot; style=&quot;box-sizing: border-box; color: #0086b3; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;Net&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;pl-vo&quot; style=&quot;box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;HTTP&lt;/span&gt;&#39; API internally,&amp;nbsp;&lt;/li&gt;&lt;li&gt;Tested with&amp;nbsp;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://github.com/jnunemaker/httparty&quot; target=&quot;_blank&quot;&gt;HTTParty&lt;/a&gt;&lt;/b&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://github.com/lostisland/faraday/&quot; target=&quot;_blank&quot;&gt;Faraday&lt;/a&gt;&lt;/b&gt;,&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://github.com/rest-client/rest-client&quot; target=&quot;_blank&quot;&gt;RestClient&lt;/a&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;not working with&amp;nbsp;&lt;b style=&quot;color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 17.2549991607666px;&quot;&gt;&lt;a href=&quot;https://github.com/excon/excon&quot; target=&quot;_blank&quot;&gt;Excon&lt;/a&gt;(&lt;/b&gt;so&amp;nbsp;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 17.2549991607666px;&quot;&gt;Excon&amp;nbsp;&lt;/span&gt;adapter over&amp;nbsp;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 17.2549991607666px;&quot;&gt;Faraday&lt;/span&gt;&amp;nbsp;might not work as well).&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3. Locking a file using&amp;nbsp;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;flock.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; Firstly I advise you to read through &lt;a href=&quot;http://ruby-doc.org/core-1.9.3/File.html#method-i-flock&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;flock&lt;/b&gt;&lt;/a&gt;&amp;nbsp;and also this amazing &lt;b&gt;&lt;a href=&quot;http://stackoverflow.com/questions/11837428/whats-the-difference-between-an-exclusive-lock-and-a-shared-lock/11837714#11837714&quot; target=&quot;_blank&quot;&gt;answer&lt;/a&gt;&amp;nbsp;&lt;/b&gt;by &lt;b&gt;&lt;a href=&quot;http://stackoverflow.com/users/274261/arjunshankar&quot; target=&quot;_blank&quot;&gt;Arjun Shankar&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&lt;div class=&quot;method-heading&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://ruby-doc.org/images/brick.png); background-origin: initial; background-position: 0% 100%; background-repeat: no-repeat; background-size: initial; color: #333333; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 18px; font-weight: bold; margin: 0px; padding: 2px 4px 0px 20px; position: relative;&quot;&gt;&lt;span class=&quot;method-callseq&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;flock (locking_constant )→ 0 or false&lt;/span&gt;&lt;span class=&quot;method-click-advice&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://ruby-doc.org/images/zoom.png); background-origin: initial; background-position: 100% 0%; background-repeat: no-repeat; background-size: initial; color: #9b9877; font-size: 10px; line-height: 20px; margin: 0px; padding: 0px 20px 0px 0px; position: absolute; right: 5px; top: 2px; visibility: visible;&quot;&gt;click to toggle source&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 14.3999996185303px; line-height: 21.6000003814697px; margin: 0px; padding: 0px;&quot;&gt;&lt;div style=&quot;margin-bottom: 1.5em; padding: 0px;&quot;&gt;Locks or unlocks a file according to&amp;nbsp;&lt;em style=&quot;font-weight: inherit; margin: 0px; padding: 0px;&quot;&gt;locking_constant&lt;/em&gt;&amp;nbsp;(a logical&amp;nbsp;&lt;em style=&quot;font-weight: inherit; margin: 0px; padding: 0px;&quot;&gt;or&lt;/em&gt;&amp;nbsp;of the values in the table below). Returns&amp;nbsp;&lt;code style=&quot;font-size: 1em; line-height: 1; margin: 0px; padding: 0px;&quot;&gt;false&lt;/code&gt;&amp;nbsp;if&amp;nbsp;&lt;code style=&quot;font-size: 1em; line-height: 1; margin: 0px; padding: 0px;&quot;&gt;File::LOCK_NB&lt;/code&gt;&amp;nbsp;is specified and the operation would otherwise have blocked. Not available on all platforms.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 1.5em; padding: 0px;&quot;&gt;Locking constants (in class&amp;nbsp;&lt;a href=&quot;http://ruby-doc.org/core-1.9.3/File.html&quot; style=&quot;border-bottom-color: rgb(205, 205, 205); border-bottom-style: dotted; border-bottom-width: 1px; color: rgb(51, 51, 51) !important; margin: 0px; opacity: 1; padding: 0px; text-decoration: none !important;&quot;&gt;File&lt;/a&gt;):&lt;/div&gt;&lt;pre style=&quot;background: rgb(221, 221, 221); font-size: 1em; line-height: 24px; margin-bottom: 0.5em; margin-top: 0.5em; overflow: auto; padding: 0.5em;&quot;&gt;LOCK_EX   | Exclusive lock. Only one process may hold an&lt;br /&gt;          | exclusive lock for a given file at a time.&lt;br /&gt;----------+------------------------------------------------&lt;br /&gt;LOCK_NB   | Don&#39;t block when locking. May be combined&lt;br /&gt;          | with other lock options using logical or.&lt;br /&gt;----------+------------------------------------------------&lt;br /&gt;LOCK_SH   | Shared lock. Multiple processes may each hold a&lt;br /&gt;          | shared lock for a given file at the same time.&lt;br /&gt;----------+------------------------------------------------&lt;br /&gt;LOCK_UN   | Unlock.&lt;/pre&gt;&lt;/div&gt;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;Example&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45; overflow: auto; padding: 16px; word-break: normal; word-wrap: normal;&quot;&gt;open(file,&lt;span class=&quot;pl-s1&quot; style=&quot;box-sizing: border-box; color: #df5000;&quot;&gt;&lt;span class=&quot;pl-pds&quot; style=&quot;box-sizing: border-box;&quot;&gt;&#39;&lt;/span&gt;w+&lt;span class=&quot;pl-pds&quot; style=&quot;box-sizing: border-box;&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;do &lt;/span&gt;|&lt;span class=&quot;pl-vo&quot; style=&quot;box-sizing: border-box;&quot;&gt;file&lt;/span&gt;|&lt;br /&gt;  &lt;span class=&quot;pl-c&quot; style=&quot;box-sizing: border-box; color: #969896;&quot;&gt;## lock the file so that no one can use it. &lt;/span&gt;&lt;br /&gt;  file.flock(&lt;span class=&quot;pl-s3&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;File&lt;/span&gt;::&lt;span class=&quot;pl-vo&quot; style=&quot;box-sizing: border-box;&quot;&gt;LOCK_EX&lt;/span&gt;)&lt;br /&gt;  read(file_name).each &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;do &lt;/span&gt;|&lt;span class=&quot;pl-vo&quot; style=&quot;box-sizing: border-box;&quot;&gt;row&lt;/span&gt;|&lt;br /&gt;    file.puts jsonify(row)&lt;br /&gt;  &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;end&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/8103729381494507422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2015/07/some-ruby-thing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/8103729381494507422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/8103729381494507422'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2015/07/some-ruby-thing.html' title='Some Ruby Thing '/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-3632477077998811160</id><published>2015-04-21T01:00:00.005-07:00</published><updated>2015-04-21T01:00:57.809-07:00</updated><title type='text'>Use .wgetrc for default wget settings.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I use wget quite a lot and in the end I always end up using a large number of&amp;nbsp;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;common options&lt;/b&gt;&lt;/span&gt;&amp;nbsp;like&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;-&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;c &lt;/b&gt;(to continue&lt;/span&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;resume a wget process)&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;--&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;no&lt;/span&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;check&lt;/span&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;-&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;certificate&lt;/b&gt; (ignore ssl certificate check over https)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;br /&gt;&lt;/span&gt;which eventually make it look very ugly but&amp;nbsp;thanks to&amp;nbsp;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;.wgetrc&lt;/b&gt;&lt;/span&gt;&amp;nbsp;I no longer has to do it.&lt;br /&gt;&lt;br /&gt;Create a&amp;nbsp;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;&lt;b&gt;.wgetrc&lt;/b&gt;&lt;/span&gt;&amp;nbsp;file onto your home directory&lt;br /&gt;&lt;br /&gt;JFI, Here how my current&amp;nbsp;&lt;b style=&quot;color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 17.2549991607666px;&quot;&gt;.wgetrc&lt;/b&gt;&amp;nbsp;look.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;p1&quot;&gt;&lt;pre style=&quot;background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45; overflow: auto; padding: 16px; word-break: normal; word-wrap: normal;&quot;&gt;continue&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;=&lt;/span&gt;on     &lt;span class=&quot;pl-c&quot; style=&quot;box-sizing: border-box; color: #969896;&quot;&gt;## equivalent to -c options&lt;/span&gt;&lt;br /&gt;check_certificate&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;=&lt;/span&gt;off  &lt;span class=&quot;pl-c&quot; style=&quot;box-sizing: border-box; color: #969896;&quot;&gt;## equivalent to --no-check-certificate&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;Noting it down here so I just don&#39;t forget it future.&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;Thanks&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/3632477077998811160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2015/04/use-wgetrc-for-default-wget-settings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/3632477077998811160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/3632477077998811160'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2015/04/use-wgetrc-for-default-wget-settings.html' title='Use .wgetrc for default wget settings.'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-5271273205316200703</id><published>2015-04-10T02:30:00.000-07:00</published><updated>2015-04-10T02:43:45.874-07:00</updated><title type='text'>Using HTTPProxy in Net/HTTP globally.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;There comes a time when you want to Proxy your &lt;a href=&quot;http://ruby-doc.org/stdlib-2.1.2/libdoc/net/http/rdoc/Net/HTTP.html&quot; target=&quot;_blank&quot;&gt;Net/HTTP&lt;/a&gt; request/response in &lt;b&gt;Ruby&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;One of the easy ways to do this in &lt;b&gt;NET/HTTP&lt;/b&gt;&amp;nbsp;is by passing proxy parameters in &#39;&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45;&quot;&gt;new&lt;/span&gt;&#39; &amp;nbsp;method (during&amp;nbsp;&lt;b&gt;initialization&lt;/b&gt;)&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f7f7f7; border-radius: 3px; box-sizing: border-box; color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Menlo, Courier, monospace; font-size: 11.8999996185303px; line-height: 1.45; overflow: auto; padding: 16px; word-break: normal; word-wrap: normal;&quot;&gt;proxy_addr &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-s1&quot; style=&quot;box-sizing: border-box; color: #df5000;&quot;&gt;&lt;span class=&quot;pl-pds&quot; style=&quot;box-sizing: border-box;&quot;&gt;&#39;&lt;/span&gt;your.proxy.host&lt;span class=&quot;pl-pds&quot; style=&quot;box-sizing: border-box;&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;proxy_port &lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;8080&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;pl-s3&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;Net&lt;/span&gt;::&lt;span class=&quot;pl-s3&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;HTTP&lt;/span&gt;.&lt;span class=&quot;pl-k&quot; style=&quot;box-sizing: border-box; color: #a71d5d;&quot;&gt;new&lt;/span&gt;(&lt;span class=&quot;pl-s1&quot; style=&quot;box-sizing: border-box; color: #df5000;&quot;&gt;&lt;span class=&quot;pl-pds&quot; style=&quot;box-sizing: border-box;&quot;&gt;&#39;&lt;/span&gt;example.com&lt;span class=&quot;pl-pds&quot; style=&quot;box-sizing: border-box;&quot;&gt;&#39;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;pl-c1&quot; style=&quot;box-sizing: border-box; color: #0086b3;&quot;&gt;nil&lt;/span&gt;, proxy_addr, proxy_port).start { |&lt;span class=&quot;pl-vo&quot; style=&quot;box-sizing: border-box;&quot;&gt;http&lt;/span&gt;|&lt;br /&gt;  &lt;span class=&quot;pl-c&quot; style=&quot;box-sizing: border-box; color: #969896;&quot;&gt;# always proxy via your.proxy.addr:8080&lt;/span&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;Obviously, this works but then querying the website using &lt;a href=&quot;http://ruby-doc.org/stdlib-2.1.1/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-GET&quot; target=&quot;_blank&quot;&gt;GET&lt;/a&gt; or &lt;a href=&quot;http://ruby-doc.org/stdlib-2.1.1/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-GET+by+URI&quot; target=&quot;_blank&quot;&gt;GET BY URI&lt;/a&gt;&amp;nbsp;method there is no provision to pass any proxy parameters altogether(&lt;span style=&quot;font-size: xx-small;&quot;&gt;at least&amp;nbsp;that&#39;s what I found out.&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;Thankfully Ruby-2.0+ (not available in lower versions though, can be seen over &lt;a href=&quot;http://ruby-doc.org/stdlib-1.9.3/libdoc/net/http/rdoc/Net/HTTP.html#Proxy-method&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;) has a feature with which you can provide proxy as your ENV variable (&lt;code style=&quot;background-color: #eeeeee; font-size: 1em; line-height: 1; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;http_proxy&lt;/b&gt;&lt;/code&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 14.3999996185303px; line-height: 21.6000003814697px;&quot;&gt;&amp;nbsp;environment variable)&amp;nbsp;&lt;/span&gt;and ruby take care of the rest.&lt;br /&gt;&lt;br /&gt;So, upon setting &amp;nbsp;&lt;b style=&quot;font-family: monospace; font-size: 13px; line-height: 13px;&quot;&gt;http_proxy&amp;nbsp;&lt;/b&gt;in ENV I found, BAAM!!! &amp;nbsp;it worked and it worked globally (i.e it works even on&amp;nbsp;&lt;b&gt;GET&lt;/b&gt; and&lt;b&gt; GET BY URL&lt;/b&gt;&amp;nbsp;methods mentioned above.)&lt;br /&gt;&lt;br /&gt;BTW, I had the following declaration inside my .&lt;b style=&quot;font-family: monospace; font-size: 13px; line-height: 13px;&quot;&gt;bash_profile.&lt;/b&gt;&lt;br /&gt;&lt;b style=&quot;font-family: monospace; font-size: 13px; line-height: 13px;&quot;&gt;&lt;br /&gt;&lt;/b&gt;        &lt;br /&gt;&lt;div class=&quot;p1&quot;&gt;&lt;code style=&quot;background-color: #eeeeee; font-size: 1em; line-height: 1; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;export http_proxy&lt;/b&gt;&lt;/code&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: Georgia, &#39;Times New Roman&#39;, serif; font-size: 14.3999996185303px; line-height: 21.6000003814697px;&quot;&gt;= &#39;http://127.0.0.1:8080&lt;/span&gt;&#39; &amp;nbsp;(8080 is the port where my &lt;a href=&quot;http://www.squid-cache.org/Intro/&quot; target=&quot;_blank&quot;&gt;Squid&lt;/a&gt;&amp;nbsp;Proxy is functional)&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;Thanks&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;p1&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/5271273205316200703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2015/04/using-httpproxy-in-nethttp-globally.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/5271273205316200703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/5271273205316200703'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2015/04/using-httpproxy-in-nethttp-globally.html' title='Using HTTPProxy in Net/HTTP globally.'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-8743924443776705729</id><published>2015-03-16T07:28:00.001-07:00</published><updated>2015-03-16T07:28:22.959-07:00</updated><title type='text'>Hack With Rack</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;background-color: white; border: 0px; color: #444444; font-family: helvetica, arial; font-size: 0.85rem; line-height: 25px; margin-bottom: 10px; padding: 0px 0px 20px; vertical-align: baseline;&quot;&gt;Hello everyone, Hope you are having a good day.&lt;/div&gt;&lt;div style=&quot;background-color: white; border: 0px; color: #444444; font-family: helvetica, arial; font-size: 0.85rem; line-height: 25px; margin-bottom: 10px; padding: 0px 0px 20px; vertical-align: baseline;&quot;&gt;Ok, some years ago, one of our clients wanted us to implement Social Network (FB,Twitter,Linkedin) sharing functionality. Knowing all the&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/OAuth&quot; style=&quot;border: 0px; color: #f58220; font-family: Lato; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot; title=&quot;OAuth&quot;&gt;OAuth&lt;/a&gt;&amp;nbsp;implementation that one has to deal with, we decided to use this awesome gem called&amp;nbsp;&lt;a href=&quot;https://github.com/intridea/omniauth&quot; style=&quot;border: 0px; color: #f58220; font-family: Lato; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot; title=&quot;omniauth&quot;&gt;OmniAuth&lt;/a&gt;&amp;nbsp;that does all the heavy lifting tasks of OAuth Authorisation with very basic minimum implementation.&lt;/div&gt;&lt;div style=&quot;background-color: white; border: 0px; color: #444444; font-family: helvetica, arial; font-size: 0.85rem; line-height: 25px; margin-bottom: 10px; padding: 0px 0px 20px; vertical-align: baseline;&quot;&gt;So with OmniAuth we manage to get the work done in time but then we wanted OAuth Authorisation to work with&amp;nbsp;&lt;u style=&quot;border: 0px; font-family: &#39;Open Sans&#39;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ajax call as well&lt;/u&gt;. I remember going all out crazy (Googling + debugging OmniAuth code) to find a way to do it but honestly we couldn’t find any way do it. (Note: This was some years back I’m not sure about the status as of now.)&lt;/div&gt;&lt;div style=&quot;background-color: white; border: 0px; color: #444444; font-family: helvetica, arial; font-size: 0.85rem; line-height: 25px; margin-bottom: 10px; padding: 0px 0px 20px; vertical-align: baseline;&quot;&gt;So we decide to write our own “&lt;strong style=&quot;border: 0px; font-family: &#39;Open Sans&#39;, Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Rack Middleware&lt;/strong&gt;” that tampers with the Omniauth Response and treats the ajax request the way we wanted.&lt;/div&gt;&lt;div style=&quot;background-color: white; border: 0px; color: #444444; font-family: helvetica, arial; font-size: 0.85rem; line-height: 25px; margin-bottom: 10px; padding: 0px 0px 20px; vertical-align: baseline;&quot;&gt;The Middleware &lt;/div&gt;&lt;script src=&quot;https://gist.github.com/meetme2meat/079325ce46e95e26acde.js&quot;&gt;&lt;/script&gt; &lt;br /&gt;&lt;div style=&quot;background-color: white; border: 0px; margin-bottom: 10px; padding: 0px 0px 20px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: helvetica, arial; font-size: 0.85rem; line-height: 25px;&quot;&gt;and then we insert the Middleware where we wanted it&lt;/span&gt;&lt;/div&gt;&lt;script src=&quot;https://gist.github.com/meetme2meat/9992d647ae499096ed5d.js&quot;&gt;&lt;/script&gt; &lt;br /&gt;&lt;div style=&quot;background-color: white; border: 0px; color: #444444; font-family: helvetica, arial; font-size: 0.85rem; line-height: 25px; margin-bottom: 10px; padding: 0px 0px 20px; vertical-align: baseline;&quot;&gt;Let look at our middleware stack&lt;/div&gt;&lt;script src=&quot;https://gist.github.com/meetme2meat/853007dbddd21f223215.js&quot;&gt;&lt;/script&gt; &lt;div style=&quot;background-color: white; border: 0px; color: #444444; font-family: helvetica, arial; font-size: 0.85rem; line-height: 25px; margin-bottom: 10px; padding: 0px 0px 20px; vertical-align: baseline;&quot;&gt;Yup that&#39;s it- a &quot;&lt;b&gt;Hack with Rack&lt;/b&gt;&quot; to get a concrete solution for our problem that isn&#39;t too fancy but still does the task we needed getting done.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/8743924443776705729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2015/03/hack-with-rack.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/8743924443776705729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/8743924443776705729'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2015/03/hack-with-rack.html' title='Hack With Rack'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-4140668939088503625</id><published>2013-09-01T23:45:00.000-07:00</published><updated>2013-09-11T23:59:14.565-07:00</updated><title type='text'>Some Carrierwave Tip n Tricks</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Finally wait is over I mean after nearly a rough patch of virtually no post for an year I back with a post again&lt;br /&gt;&lt;br /&gt;As the title suggest it with regards to some tips and tricks that I manage to pull on carrierwave when working on a project&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;A) &lt;span style=&quot;font-size: large;&quot;&gt;Upload Simultaneously to File and S3&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I know there are tons of way to do this like upload the file first to server and then using the background process upload it to &lt;b&gt;S3&lt;/b&gt; blah blah .&lt;br /&gt;Even directly upload to&lt;b&gt;&amp;nbsp;S3&lt;/b&gt;&amp;nbsp;is also an options since &lt;a href=&quot;http://aws.amazon.com/s3/&quot; target=&quot;_blank&quot;&gt;AMAZON S3&lt;/a&gt;&amp;nbsp;allow &lt;a href=&quot;http://en.wikipedia.org/wiki/Cross-origin_resource_sharing&quot; target=&quot;_blank&quot;&gt;CORS&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Well all this work great but I kind of not want to do them perhaps, may try some other approach&lt;br /&gt;(Mind you nothing against the other approach mention thus after or already exists)&lt;br /&gt;&lt;br /&gt;So what is my approach well basically nothing all you have to do customize your uploader a bit (not heavy customization though )&lt;br /&gt;&lt;br /&gt;Consider this is your standard uploader look like &amp;nbsp;with default storage as &lt;b&gt;:file&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;MyUploader&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;CarrierWave&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Uploader&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Base&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:file&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;blah&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;blah&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;blah&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;Now to simultaneously upload it to S3 all you have to do is place this in your &lt;b&gt;uploader.&lt;/b&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt; &lt;span class=&quot;n&quot;&gt;version&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:s3_version&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:fog&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;full_file_name&lt;/span&gt;&lt;br /&gt;       &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/s3_version_/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;So your uploader finally look like this&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;MyUploader&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;CarrierWave&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Uploader&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Base&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:file&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;blah&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;blah&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class=&quot;n&quot;&gt;version&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:s3_version&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;n&quot;&gt;storage&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:fog&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;full_file_name&lt;/span&gt;&lt;br /&gt;       &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/s3_version_/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;That it define a version &lt;b&gt;:s3_version&lt;/b&gt; (virtually any name you want) and then use storage as &lt;b&gt;:fog &lt;/b&gt;in it (make sure to change the &lt;b&gt;REGULAR EXPRESSION&lt;/b&gt;&amp;nbsp;incase you chose a different version name other then &lt;b&gt;s3_version&lt;/b&gt;)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note :&lt;/b&gt;&amp;nbsp;Also make sure to add the FOG setting for Carrierwave (S3 is just taken as an example it would work it all storage that fog provide)&lt;br /&gt;&lt;br /&gt;Now most of you would argue that if say&amp;nbsp;&lt;b&gt;S3 &lt;/b&gt;isn&#39;t responding/ something goes &lt;b&gt;wrong &lt;/b&gt;in &lt;b&gt;S3&lt;/b&gt;&amp;nbsp;over net, then your local storage goes for a toss and I agree completely with that to so I urge viewer to please take a note of this . Well for me I happy taking that risk on my part . :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;B). &lt;span style=&quot;font-size: large;&quot;&gt;Delete the record but don&#39;t delete the attachment&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Well not all would agree with me on this but there are time when we been ask to &lt;b&gt;delete the uploader &lt;/b&gt;record but &lt;b&gt;not delete the file stored&amp;nbsp;&lt;/b&gt;:)&lt;br /&gt;&lt;br /&gt;There could be many reason like in my case there was a requirement that we need to retain the original copy of the client registered agreement even though the client not longer exists&lt;br /&gt;&lt;br /&gt;As said there exists even a dozen tons of ways to achieve this as well but let me show you how I manage to pull off this.&lt;br /&gt;&lt;br /&gt;All I did is I overwrite the method &lt;b&gt;remove!&amp;nbsp;&lt;/b&gt;&amp;nbsp;in my &lt;b&gt;uploader&lt;/b&gt; and I also define a &lt;b&gt;attr_accessor&lt;/b&gt; against my model (i.e&amp;nbsp;&lt;span style=&quot;background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; line-height: 17.265625px;&quot;&gt;attr_accessor :keep_file&lt;/span&gt;&amp;nbsp;on my model)&lt;br /&gt;&lt;br /&gt;Enough said time for code&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;MyUploader&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;CarrierWave&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Uploader&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Base&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;remove!&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;keep_file&lt;/span&gt;&lt;br /&gt;       &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;super&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now to secure the storage file and only delete the record all I did is set &amp;nbsp;&lt;b&gt;:keep_file =&amp;gt; true &lt;/b&gt;and rest is taken care.&lt;br /&gt;&lt;br /&gt;What I mean is record are destroyed but not the file from the storage system with this&lt;br /&gt;&lt;br /&gt;There is another approach but I now tried and tested it that one would to overwrite the &lt;b&gt;remove?&amp;nbsp;&lt;/b&gt;&lt;br /&gt;method &amp;nbsp;something like this (Note I haven&#39;t tested this )&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;MyUploader&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;CarrierWave&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Uploader&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Base&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;remove?&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style=&quot;color: red;&quot;&gt;C). &lt;span style=&quot;font-size: large;&quot;&gt;Custom the CarrierWave Error Message&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Ever since I question/answered my own &lt;a href=&quot;http://stackoverflow.com/questions/9784475/setting-custom-error-message-with-carrierwave&quot; target=&quot;_blank&quot;&gt;question&lt;/a&gt;&amp;nbsp;I&#39;m seeing that I&#39;m getting a lot of traction on it . What I have asked for is -&lt;br /&gt;&lt;br /&gt;How to change the Carrierwave error message and set your own ?.&lt;br /&gt;&lt;br /&gt;Well clearly the answer for that is define a key/value in your &lt;b&gt;en.yml&lt;/b&gt; for desired carrierwave error message and that it&lt;br /&gt;&lt;br /&gt;e.g Let say &lt;b&gt;Carrierwave &lt;/b&gt;default message on extensions &lt;b&gt;whilelists valdations&lt;/b&gt; is this&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;l-Scalar-Plain&quot;&gt;You are not allowed to upload %{extension} files, allowed types&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;err&quot; style=&quot;background-color: #e3d2d2; color: #a61717;&quot;&gt;%&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nv&quot; style=&quot;color: teal;&quot;&gt;allowed_types&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;Now want is to change reason (reason with held with me :) ) . So all I have to do is this&lt;br /&gt;&lt;br /&gt;in my &lt;b&gt;en.yml&lt;/b&gt; define something like this&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;l-Scalar-Plain&quot;&gt;en&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;l-Scalar-Plain&quot;&gt;errors&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;l-Scalar-Plain&quot;&gt;messages&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt;&lt;br /&gt;       &lt;span class=&quot;l-Scalar-Plain&quot;&gt;extension_white_list_error&lt;/span&gt;&lt;span class=&quot;p-Indicator&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;My&lt;/span&gt;&lt;span class=&quot;nv&quot; style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;Custom&lt;/span&gt;&lt;span class=&quot;nv&quot; style=&quot;color: teal;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;Message&#39;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;A full list of carrierwave key/value pair can be found over &lt;a href=&quot;https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/locale/en.yml&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That it guys hope you liked the tricks and found it useful&lt;br /&gt;&lt;br /&gt;Thank You&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/4140668939088503625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2013/09/some-carrierwave-tip-n-tricks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/4140668939088503625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/4140668939088503625'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2013/09/some-carrierwave-tip-n-tricks.html' title='Some Carrierwave Tip n Tricks'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-4515606876874994245</id><published>2013-08-23T08:00:00.000-07:00</published><updated>2013-08-23T08:08:37.838-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ActiveRecord"/><category scheme="http://www.blogger.com/atom/ns#" term="Database"/><category scheme="http://www.blogger.com/atom/ns#" term="FLOAT"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Precision"/><category scheme="http://www.blogger.com/atom/ns#" term="Rails"/><title type='text'>Lesson Learnt about MySQL Datatype</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;The Content is derived from&amp;nbsp;&lt;a href=&quot;http://rubyonrails.org/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Rails&lt;/b&gt;&lt;/a&gt;&amp;nbsp;audiences but it useful for all those guys who ever had used/currently using &amp;nbsp;framework which had/have a sugar coated &lt;b&gt;Database Mapper&lt;/b&gt; encapsulated in them now as said it derived from&amp;nbsp;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;Rails&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;because it too has a&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Object-relational_mapping&quot; style=&quot;font-size: 12.800000190734863px;&quot; target=&quot;_blank&quot;&gt;ORM&lt;/a&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&amp;nbsp;mapper called &lt;b&gt;ActiveRecord &lt;/b&gt;(All Rails guys would be aware of this) .&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;The post is to describe how &lt;b&gt;naively we ignore&lt;/b&gt; the database ideology and lay all our worries to &lt;b&gt;ActiveRecord&lt;/b&gt; and one of this worry is defining &lt;b&gt;Data Type&lt;/b&gt; in ActiveRecord .&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;All Rails guys would be quite familiar with the following command .&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;rails&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;g&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;migration&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;add_column_to_some_table&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;some_column&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:float&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;n&quot;&gt;rake&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;migrate&lt;/span&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Now this create a datatype&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;FLOAT&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;in database (&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;il&quot;&gt;&lt;a href=&quot;http://www.mysql.com/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;MySQL&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;) .&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;div style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Now all look fine up till now but there is problem (if your using&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;MySQL&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;database preferably) .&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;div style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Problem is , h&lt;/span&gt;&lt;span style=&quot;background-color: white; font-size: 12.800000190734863px;&quot;&gt;ow MySQL&amp;nbsp;intend&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;il&quot; style=&quot;font-size: 12.800000190734863px;&quot;&gt;&lt;b style=&quot;background-color: white;&quot;&gt;FLOAT&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-size: 12.800000190734863px;&quot;&gt;&amp;nbsp; DataType .&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;background-color: white; font-size: 12.800000190734863px;&quot;&gt;According to &amp;nbsp;&lt;/span&gt;&lt;span class=&quot;il&quot; style=&quot;background-color: white; font-size: 12.800000190734863px;&quot;&gt;MySQL&lt;/span&gt;&lt;span style=&quot;background-color: white; font-size: 12.800000190734863px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/floating-point-types.html&quot; style=&quot;background-color: white; color: #1155cc; font-size: 12.800000190734863px;&quot; target=&quot;_blank&quot;&gt;documentation&lt;/a&gt;&lt;span style=&quot;background-color: white; font-size: 12.800000190734863px;&quot;&gt;&amp;nbsp;. MySQL expect the FLOAT datatype definition to look like this .&lt;/span&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;alter&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;some_tables&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;change&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;some_column&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;some_column&lt;/span&gt; &lt;span class=&quot;kt&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;float&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;I mean &lt;b&gt;float(L,P) .&lt;/b&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;L&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Length&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;n&quot;&gt;P&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Number&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;Precision&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Value&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;So from above&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&amp;nbsp;&quot;7&quot; is length of the number and &quot;4&quot; is max precision so the max number that specify (7,4) criteria is&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-size: 12.800000190734863px;&quot;&gt;999.9999 .&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Now as usual it not mention anywhere in the&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;il&quot; style=&quot;background-color: white;&quot;&gt;MySQL&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;documentation&lt;/span&gt;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt; what is &lt;b&gt;default&lt;/b&gt; format of&lt;b&gt;&amp;nbsp;&lt;span class=&quot;il&quot;&gt;FLOAT&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;if not specified (because that what the above migration do ,it define a&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;il&quot; style=&quot;background-color: white;&quot;&gt;FLOAT&lt;/span&gt;&lt;b style=&quot;background-color: white;&quot;&gt;&amp;nbsp;without any precision&lt;/b&gt;&lt;span style=&quot;background-color: white;&quot;&gt; format as expected by&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;il&quot;&gt;MySQL just a common practice I&#39;ve seen with many developer now&lt;/span&gt;)&lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt; .&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;div style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white;&quot;&gt;So what is the FLOAT format when not specified like above .&lt;/div&gt;&lt;div style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;The answer is&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&lt;span style=&quot;background-color: #ffe599;&quot;&gt;Default Precision (6,0) &lt;/span&gt;&lt;span style=&quot;background-color: white;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;div style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;background-color: white;&quot;&gt;So here how the number format look like with&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;il&quot; style=&quot;background-color: white;&quot;&gt;MySQL .&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Real&lt;/span&gt; &lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;World&lt;/span&gt;                    &lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;MySQL&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;511111&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;1221&lt;/span&gt;                   &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;511111&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;51111&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;1221&lt;/span&gt;                    &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;51111&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;1&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;5111&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;1221&lt;/span&gt;                     &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;5111&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;12&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;                      &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;                      &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;You can do the maths for remain series of number .&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;b&gt;BUT&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;Confusion start when you &lt;b&gt;exceed 6 digit .&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Real&lt;/span&gt; &lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;World&lt;/span&gt;                  &lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;MySQL&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;5111111&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;12121&lt;/span&gt;              &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;5111110&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;51111111&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;12121&lt;/span&gt;             &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;51111100&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;511111111&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;12121&lt;/span&gt;            &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;511111100&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;So the point is,Now no matter what only 6 digit will be ever be present from &lt;b&gt;LHS&lt;/b&gt;(&lt;b&gt;L&lt;/b&gt;eft &lt;b&gt;H&lt;/b&gt;and &lt;b&gt;S&lt;/b&gt;ide) btw rest all will be &lt;b&gt;rounded&lt;/b&gt; according to the rounding logic .&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;So Friend a a word of Caution is required before using&lt;/span&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;il&quot; style=&quot;background-color: #ffffcc; font-size: 12.800000190734863px;&quot;&gt;&lt;b&gt;FLOAT&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;without digit and precision format declaration .&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 12.800000190734863px;&quot;&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;A Lesson well Learnt .&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;Thanks&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 12.800000190734863px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/4515606876874994245/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2013/08/less-learnt-on-mysql-datatype.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/4515606876874994245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/4515606876874994245'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2013/08/less-learnt-on-mysql-datatype.html' title='Lesson Learnt about MySQL Datatype'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-2913666382017675049</id><published>2012-04-23T11:13:00.002-07:00</published><updated>2013-08-23T05:48:46.594-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ActionDispatcher"/><category scheme="http://www.blogger.com/atom/ns#" term="ActionMailer"/><category scheme="http://www.blogger.com/atom/ns#" term="ActiveModel"/><category scheme="http://www.blogger.com/atom/ns#" term="ActiveRelation"/><category scheme="http://www.blogger.com/atom/ns#" term="ActiveReload"/><category scheme="http://www.blogger.com/atom/ns#" term="AssetPipeline"/><category scheme="http://www.blogger.com/atom/ns#" term="Bundler"/><category scheme="http://www.blogger.com/atom/ns#" term="Erubius"/><category scheme="http://www.blogger.com/atom/ns#" term="Explain"/><category scheme="http://www.blogger.com/atom/ns#" term="Rails"/><category scheme="http://www.blogger.com/atom/ns#" term="Rails Documentation"/><category scheme="http://www.blogger.com/atom/ns#" term="Rails2.3+"/><category scheme="http://www.blogger.com/atom/ns#" term="Rails3+"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="Template Inheritance"/><title type='text'>What I missing in Rails 2.3+</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Well 3.1 and 3.2 is been out for quite a while now so I intend to dedicate this post is for all those fellow coder who still believe or want to maintain there code with rails 2.3+ to let them know that what actually they are missing&lt;br /&gt;&lt;br /&gt;If I happen I go about and write the all new feature of rails 3.1 or rails 3.2 then I guess I will run out of word but still I ensure that I cover most important one though&lt;br /&gt;&lt;br /&gt;1. &lt;b&gt;Unobtrusive Javascript&lt;/b&gt; :&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Before I move ahead and announcement ,Rails 3+ has default javascript framework as&amp;nbsp;&lt;a href=&quot;http://jquery.com/&quot; target=&quot;_blank&quot;&gt;jQuery&lt;/a&gt;&amp;nbsp;instead of &lt;a href=&quot;http://prototypejs.org/&quot; target=&quot;_blank&quot;&gt;Prototype&lt;/a&gt;&amp;nbsp;as opposed to rails 2.3+ and older version (+1 on this)&amp;nbsp;and by adapting HTML standard Rails 3+ encourage developer to write unobtrusive javascript and give them the ability to work seemless of javascript frameworks in our case its jquery(default) so all you need is to install the gem &lt;a href=&quot;https://github.com/rails/jquery-ujs&quot; target=&quot;_blank&quot;&gt;jquery_ujs&lt;/a&gt;(&lt;span style=&quot;font-size: xx-small;&quot;&gt; &lt;span style=&quot;color: #e06666;&quot;&gt;you dont have to do this for rails-3.2&lt;/span&gt;&lt;/span&gt;).If your a prototype support dont get dishearten there is a piece of cake for you too just install the &lt;a href=&quot;https://github.com/rails/prototype-rails&quot; target=&quot;_blank&quot;&gt;prototype-rails&lt;/a&gt; gem and your ready to go&lt;br /&gt;&lt;br /&gt;Now all by developer folks would agree with me saying that &amp;nbsp;back in rails 2.3+ days writing erb code server side would turn up looking one big mess in HTML&lt;br /&gt;here what I meant&lt;br /&gt;&lt;br /&gt;a simple delete link in rails 2.3+ would look like this&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;link_to&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Destroy&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:confirm&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Are you sure?&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:method&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:delete&lt;/span&gt; &lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;under the hood create such a big mess in HTML&lt;br /&gt;&lt;span class=&quot;nt&quot; style=&quot;color: navy; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;nt&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot; style=&quot;color: teal;&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;/users/1&quot;&lt;/span&gt; &lt;span class=&quot;na&quot; style=&quot;color: teal;&quot;&gt;onclick=&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;if (confirm(&#39;Are you sure?&#39;)) { var f = document.createElement(&#39;form&#39;); f.style.display = &#39;none&#39;; this.parentNode.appendChild(f); f.method = &#39;POST&#39;; f.action = this.href;var m = document.createElement(&#39;input&#39;); m.setAttribute(&#39;type&#39;, &#39;hidden&#39;); m.setAttribute(&#39;name&#39;, &#39;_method&#39;); m.setAttribute(&#39;value&#39;, &#39;delete&#39;); f.appendChild(m);var s = document.createElement(&#39;input&#39;); s.setAttribute(&#39;type&#39;, &#39;hidden&#39;); s.setAttribute(&#39;name&#39;, &#39;authenticity_token&#39;); s.setAttribute(&#39;value&#39;, &#39;FqAHj1L667xA8SmeQjHvVncy8WJz0shaoKjiLHbhQT0=&#39;); f.appendChild(s);f.submit(); };return false;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot; style=&quot;color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;Destroy&lt;span class=&quot;nt&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/pre&gt;same is true if your writing and ajax related code using using any of Rails 2.3+ ajax helper (e.g link_to_remote,remote_form_for etc)&lt;br /&gt;&lt;br /&gt;Now with Rails 3+ you can just clean all this mess let me show you how .&lt;br /&gt;&lt;b&gt;link_to_remote&lt;/b&gt; is replace &amp;nbsp;with &amp;nbsp;normal &lt;b&gt;link_to&lt;/b&gt; syntax with once extra parameter &lt;b&gt;remote =&amp;gt; true&lt;/b&gt; &amp;nbsp;providing this &amp;nbsp;help in rails understand to create a link that under hood fire an ajax request (&lt;span style=&quot;color: #e06666; font-size: xx-small;&quot;&gt;identified by jquery_ujs on click&lt;/span&gt;)which is basically achieve by creating a custom &lt;a href=&quot;http://ejohn.org/blog/html-5-data-attributes/&quot; target=&quot;_blank&quot;&gt;data-attribute&lt;/a&gt; &lt;b&gt;data-remote =&amp;gt; true&lt;/b&gt;&amp;nbsp;. same is true with &lt;b&gt;confirm&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In Rails 2.3+ a normal &lt;b&gt;link_to_remote&lt;/b&gt; would look like this.&lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;link_to_remote&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Edit&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:url&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;edit_user_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;this will produce html on browser like this.&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;nt&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot; style=&quot;color: teal;&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;#&quot;&lt;/span&gt; &lt;span class=&quot;na&quot; style=&quot;color: teal;&quot;&gt;onclick=&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;new Ajax.Request(&#39;/users/1/edit&#39;, {asynchronous:true, evalScripts:true, parameters:&#39;authenticity_token=&#39; + encodeURIComponent(&#39;FqAHj1L667xA8SmeQjHvVncy8WJz0shaoKjiLHbhQT0=&#39;)}); return &lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;false;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot; style=&quot;color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;Edit&lt;span class=&quot;nt&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/pre&gt;not so clean let see the same in Rails3+ with slightly different syntax.&lt;br /&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;link_to&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Edit&#39;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;edit_user_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:remote&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;would produce the below underlying HTML code in browser&lt;/div&gt;&lt;div&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;/users/3/edit&quot;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;remote&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Edit&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/a&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;Totally u&lt;span style=&quot;text-align: left;&quot;&gt;nobtrusive Javascript&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;So now hence forth the both server side and client side code is much cleaner now hooray !!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. &lt;b&gt;ActiveRelation (AREL - CHAINING QUERY)&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I must admit this the &amp;nbsp;first time I heard this it just blew me the ActiveRelation original created by and written &lt;a href=&quot;https://github.com/nkallen/arel&quot; target=&quot;_blank&quot;&gt;nkallen&lt;/a&gt;&amp;nbsp;before rewritten by many especially one person &lt;a href=&quot;https://github.com/tenderlove/arel&quot; target=&quot;_blank&quot;&gt;Aaron Patterson&lt;/a&gt;&amp;nbsp;citing performance issue thankfully it done now.&lt;br /&gt;&lt;span style=&quot;color: #e06666; font-size: xx-small;&quot;&gt;(want to know more about ActiveRelation please go through this )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;What ActiveRelation basically mean is back in Rails 2.3+ if you want to retrieve&amp;nbsp;record from a database you basically would do use any of this&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:conditions&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;&amp;nbsp;&lt;span style=&quot;color: #e06666; font-size: xx-small;&quot;&gt;e.g (list all user that are admin right in the application)&lt;/span&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:conditions&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:admin&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;Now in Rails 3+ you could achieve this using&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;your conidtion&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;e.g&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;admin =?&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;Now the basic difference between the above two query interface apart from &amp;nbsp;syntax is that earlier one (&lt;b&gt;Model.find() &lt;/b&gt;) return you all records &amp;nbsp;against your query&lt;br /&gt;but the latter(&lt;b&gt;Model.where&lt;/b&gt;) one return you with a relation object which is cool&lt;br /&gt;because this mean I can just &lt;b&gt;chaining the query to every relation&lt;/b&gt; object returned&lt;br /&gt;&lt;br /&gt;like&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;/pre&gt;Now the actual query is fired only when you&amp;nbsp;&lt;b&gt;enumerate&lt;/b&gt; over your object or &amp;nbsp;you supply a &#39;&lt;b&gt;.all&lt;/b&gt;&#39; syntax to end of Query&lt;br /&gt;&lt;br /&gt;like&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Model&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;select&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;all&lt;/span&gt;&lt;/pre&gt;So what Rails 3+ essential does is it kind of lazy load all of records only when you actually need it. Simply Awesome&lt;br /&gt;&lt;br /&gt;Here list of method that Rails 3+ ActiveRecord provide&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt; - where&lt;br /&gt; - select&lt;br /&gt; - group&lt;br /&gt; - order&lt;br /&gt; - reorder&lt;br /&gt; - reverse_order&lt;br /&gt; - limit&lt;br /&gt; - offset&lt;br /&gt; - joins&lt;br /&gt; - includes&lt;br /&gt; - lock&lt;br /&gt; - readonly&lt;br /&gt; - from&lt;br /&gt; - having&lt;/pre&gt;Which such Awesome feature Rails 3+ also has support for old syntax to so as to help migrating Rails 2.3+ application to 3+&lt;br /&gt;&lt;br /&gt;Just in inline what used to &lt;b&gt;named_scope&lt;/b&gt; in rails-2.3+ is &#39;&lt;b&gt;scope&lt;/b&gt;&#39; in rails 3+ hence worth you like to use named scope something like this&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:admin&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;where&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;admin =?&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;admin&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;3. &lt;b&gt;Action Dispatcher (New Route API)&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;Yes with all the this amazing changes there are changes in Rails 3+ routing too.In&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&amp;nbsp;Rails 3+ the Routing API is much more cleaner and sound a bit more Rubyish here I will list the difference between rails 2.3+ and newest syntax&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;i.Now the routes is laid all under your app name&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;something like&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;RentHouse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Application&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;routes&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;draw&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;(RentHouse is your &lt;b&gt;app &lt;/b&gt;name)&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;instead of ActionController in Rails 2.3+&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;ActionController&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Routing&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Routes&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;draw&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;ii.Get rid of &lt;b&gt;block parameter&lt;/b&gt;(&lt;b&gt;map&lt;/b&gt;). Now you see map is now more an options in rails3+&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;iii. &lt;i&gt;&lt;u&gt;nested resources&lt;/u&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&amp;nbsp;In rails2.3+&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt; &lt;span class=&quot;n&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:products&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;products&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;n&quot;&gt;products&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:comments&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;n&quot;&gt;products&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:sales&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:collection&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:recent&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;Same can be achieve using&amp;nbsp;Rails 3+&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;  &lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:products&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:comments&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:sales&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;n&quot;&gt;collection&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;br /&gt;        &lt;span class=&quot;n&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;recent&#39;&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&amp;nbsp; or&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt; resources&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:products&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:comments&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:sales&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt;&lt;br /&gt;       &lt;span class=&quot;n&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;recent&#39;&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:as&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;collection&quot;&lt;/span&gt;  &lt;br /&gt;     &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;Sound more rubuies right I dont know about you guys I feel Rails 3+ simple act like DSL where you define Domain logic &amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;iv . &lt;i&gt;&lt;u&gt;Regular Routes&lt;/u&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&amp;nbsp;Rails 2.3+&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;connect&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;product_describe&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:controller&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;products&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:action&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;describe&quot;&lt;/span&gt; &lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&amp;nbsp;In Rails 3+&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;product_describe&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:to&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;products#describe&quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;Look a bit cleaner right&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;v. &lt;i&gt;&lt;u&gt;Named Routes&lt;/u&gt;&lt;/i&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;br /&gt;&amp;nbsp;In Rails 2.3+&amp;nbsp;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;product_describe&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:controller &lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;products&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:action&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;describe&quot;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;In Rails 3+&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;product_describe&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:to&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;products#describe&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:as&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:describe&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Now there quite a lot more changes in Routes I recommend refer Rails 3+ &lt;a href=&quot;http://guides.rubyonrails.org/routing.html&quot; target=&quot;_blank&quot;&gt;routing API&lt;/a&gt; for more information&lt;br /&gt;&lt;br /&gt;vi. Here an announcement coming&lt;br /&gt;&amp;nbsp; &quot;&lt;b&gt;Rails has never been so Rack &lt;span style=&quot;color: #6aa84f;&quot;&gt;friendly&lt;/span&gt; as Rails3+ is&lt;/b&gt;&quot;&lt;br /&gt;&lt;br /&gt;Now you can just plug and play any of your rack app in Rails3+ and it way to easy and Routes too is no exception (as rails3+ routes embrace so beautifully just like that whole rails)&lt;br /&gt;&lt;br /&gt;mount your rack app all you need is point it in your routes&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt; &lt;span class=&quot;n&quot;&gt;match&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;/rack_it_up&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:to&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;RackItUp&lt;/span&gt;&lt;/pre&gt;(RackItUp is rack app (sinatra,cramp,or anything else)&lt;br /&gt;&lt;br /&gt;&lt;div&gt;So Awesome&amp;nbsp;&amp;lt;3 Rails3+&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;4. &lt;b&gt;ActionMailer API Rewritten.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; This is brand( I mean rewritten) new by &lt;a href=&quot;https://github.com/mikel&quot; target=&quot;_blank&quot;&gt;Mike Lindsaar&lt;/a&gt; I guess we all knew that in Rails 2.3+ ActionMailer use &lt;a href=&quot;https://github.com/mikel/tmail&quot; target=&quot;_blank&quot;&gt;tmail&lt;/a&gt; gem well I guess in Rails 3+ it been rewritten with &lt;a href=&quot;https://github.com/mikel/mail&quot; target=&quot;_blank&quot;&gt;mail&lt;/a&gt; gem &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;br /&gt;Apart from mail gem &lt;b&gt;ActionMailer&lt;/b&gt; has separate directory now for all your mailer code. Which I guess I was missing in Rails 2.3+ where one just would write there mailer code inside model. the syntax too is bit change now here a user_creation_mail&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Now in Rails 2.3+ you would have code written like this&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;DeliveryMailer&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;user_creation_email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user_created&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt;   &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;User Registration Mail&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;recipients&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_create&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;myapp@test.com&#39;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:user&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:password&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;To sent the mail we would call&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;DeliveryMailer&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;deliver_user_creation_email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;SECRET&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;text-align: left;&quot;&gt;Same in Rails 3+ with mail gem would be written as&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;DeliveryMailer&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;user_creation_email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user_created&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;vi&quot; style=&quot;color: teal;&quot;&gt;@user&lt;/span&gt;     &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_created&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;vi&quot; style=&quot;color: teal;&quot;&gt;@password&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;password&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;vi&quot; style=&quot;color: teal;&quot;&gt;@from&lt;/span&gt;     &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;myapp@test.com&#39;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;mail&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:to&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;user_created&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:subject&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;User Registration&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;Now to deliver this mail all you need to do is &amp;nbsp;call&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;DeliveryMailer&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user_creation_email&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;SECRET&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;deliver&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Kind of look neat isn&#39;t it&lt;/div&gt;&lt;br /&gt;Note that we are passing object in instance variables so that we can use them in the email template.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: -webkit-auto;&quot;&gt;&lt;span style=&quot;color: #990000; font-family: &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace;&quot;&gt;&lt;span style=&quot;line-height: 22px; white-space: pre;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;5. &lt;b&gt;ActiveModel&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Shout loud if you feel in rails-2.3+ managing tableless model or using some &lt;a href=&quot;http://en.wikipedia.org/wiki/NoSQL&quot; target=&quot;_blank&quot;&gt;noSQL&lt;/a&gt; with model was so much pain&lt;br /&gt;&lt;br /&gt;First you need to uncomment -active_record from your environments file asking it(rails) not to be loaded AciveRecord in Rails(really), as if that was not enough.you happen to stumble upon all the errors that you never encounter&lt;br /&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;if you want to achieve this in Rails2.3+ here a &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span lang=&quot;zxx&quot;&gt;&lt;u&gt;&lt;a href=&quot;http://codetunes.com/2008/07/20/tableless-models-in-rails&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;link&lt;/span&gt;&lt;/a&gt;&lt;/u&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;.)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;br /&gt;&lt;/div&gt;Now if you want to associate callbacks or validations with your model. You probably think of writing your own(and there goes DRY ideology) , wasn&#39;t there something that has all the underlying ActiveRecord API where all the validation and callbacks would be defined which would help in better managing of &lt;b&gt;noSQL&lt;/b&gt; or tableless model easy&lt;br /&gt;&lt;br /&gt;Now a step ahead .You think Rails 3+ has it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ActiveModel&lt;/b&gt; is the place where all the validation and callbacks of ActiveRecord are define now we could integrate ActiveModel in your models and you could have all validation and callbacks in a snap.&lt;br /&gt;&lt;br /&gt;Great work Guys Love you Rails3+ for this.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6.&lt;b&gt; Faster Development ActiveReload&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;I guess this was integrated in Rails 3.2 . How activereload gem created by &lt;a href=&quot;https://github.com/paneq/active_reload&quot; target=&quot;_blank&quot;&gt;Robert Pankowecki&lt;/a&gt;&amp;nbsp;which basically started as project to speed up development environment quickly became the most downloadable library to speed up your development environment insanely fast close 300% faster . Now the good new is that active_reload in merge in Rails 3.2 here the &lt;a href=&quot;http://blog.robert.pankowecki.pl/2012/01/active-reload-mission-accomplished.html&quot; target=&quot;_blank&quot;&gt;story&lt;/a&gt; you may want read .Written by Robert about how his gem active_reload &lt;br /&gt;&lt;br /&gt;As his word &amp;nbsp;&quot;&lt;b&gt;Die ActiveReload long live Rails &lt;/b&gt;&lt;span style=&quot;color: #666666; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: medium;&quot;&gt;&lt;span style=&quot;line-height: 18px;&quot;&gt;&lt;b&gt;&quot;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;All Hail Rails&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. &lt;b&gt;Asset Pipeline&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; I guess this feature was introduce in Rails 3.1 what it basically means a better management of your assets (images,stylesheets,javascript) for your applications.&lt;br /&gt;&lt;br /&gt;As of Rails 3.1 provide you a bunch of assets directory under &#39;app&#39; ,&#39;lib&#39;, &#39;public&#39;, &#39;vendor&#39; Now you would place any of your assets any where in the assets directory listed under (&#39;app&#39;,&#39;lib&#39; .. ) and it would be loaded in application .&lt;br /&gt;&lt;br /&gt;Also Rails 3.1 has a support for &lt;a href=&quot;http://coffeescript.org/&quot; target=&quot;_blank&quot;&gt;coffeescript&lt;/a&gt; and &lt;a href=&quot;http://sass-lang.com/&quot; target=&quot;_blank&quot;&gt;sass&lt;/a&gt; default you could write your javascript or stylesheet in coffee or sass and rails would compile the same for you on run time.&lt;br /&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;(Note that you don&#39;t want to do this production as you don&#39;t need you asset to compile on every request)&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;You could also precompile your assets but I recommend you to do this only on production using &lt;span style=&quot;color: #e06666; font-size: xx-small;&quot;&gt;rake asset:precompile:all&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;What basically precompile do is consider that you have a application.js&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot; style=&quot;color: #0086b3;&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;jquery&#39;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot; style=&quot;color: #0086b3;&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;jquery_ujs&#39;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;//&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot; style=&quot;color: #0086b3;&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;basic&#39;&lt;/span&gt;&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;precompile&amp;nbsp;would basically club all the three file &#39;&lt;b&gt;jquery,jquery_ujs,basic&lt;/b&gt;&#39; and compress to a single with &lt;b&gt;md5 hash&lt;/b&gt; of content in filename &lt;b&gt;application[md5hash].js&lt;/b&gt; something like this&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;b&gt;application&lt;span style=&quot;color: #222222; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 17px; white-space: pre;&quot;&gt;-908e25f4bf641868d8683022a5b62f54.css&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;It also create a &lt;b&gt;gzip&lt;/b&gt; version of your assets in case if you need to allow web server to render &lt;b&gt;gzip&lt;/b&gt; version of your asset to improve transmission&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now back in rails 2.3+ to cache your asset you would do something like this.&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;javascript_include_tag&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:application&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:cache&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;And rails would create a script tag&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;nt&quot; style=&quot;color: navy;&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot; style=&quot;color: teal;&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;”/javascript/application.js?1335015587”&lt;/span&gt; &lt;span class=&quot;na&quot; style=&quot;color: teal;&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot; style=&quot;color: #dd1144;&quot;&gt;”text/javascript”&lt;/span&gt; &lt;span class=&quot;nt&quot; style=&quot;color: navy;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;where &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;1335015587&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;is the last modified time.)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;Now I have read and face many time that the web server dont treat the latter  one so gracefully (&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;b&gt;webserver&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;doesnot treat &#39;?&#39; so gracefully )&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;great step taken by rails 3 team in fixing this .&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Asset pipeline has also support for preprocessor&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;which mean you could chain your &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;b&gt;application.css&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;or &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;b&gt;application.js&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;with &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;b&gt;application.css.sass.erb&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;or &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;b&gt;application.js.coffee.erb&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;and can write sass or coffee and erb code in &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;b&gt;css&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;or &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;b&gt;js&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;and Rails would do all the necessary compiling.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;Now this is basically done using &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;span lang=&quot;zxx&quot;&gt;&lt;u&gt;&lt;a href=&quot;https://github.com/sstephenson/sprockets&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;Sprockets&lt;/span&gt;&lt;/a&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;as it drill down for each set of processors and compile the file with respect to processor (&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;b&gt;.erb,.coffee&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;8. &lt;b&gt;Template Inheritance&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;This one I badly needed it I remember how many time&amp;nbsp;I &amp;nbsp;wanted more level of layouting&amp;nbsp;thankful to Rails &amp;nbsp;team we have &amp;nbsp;template inheritance hooked in rails 3+ but&amp;nbsp;I wish rails 2.3 has this although there where gem like &lt;a href=&quot;https://github.com/botanicus/rails-template-inheritance&quot; target=&quot;_blank&quot;&gt;rails-template-inheritance&lt;/a&gt;&amp;nbsp;to achieve the same.&lt;br /&gt;&lt;br /&gt;Here what I meant with Template Inheritance&lt;br /&gt;&lt;br /&gt;consider an application where I have login page and internal pages each having different navigation (like About Us,Contact Us, etc) . Now there are several way you can achieve this segregation but using template inheritance you can achieve this by simple define navigation for each controllers in there respective view directory &amp;nbsp; &lt;br /&gt;&lt;br /&gt;e.g &amp;nbsp;my application layout preview&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;x&quot;&gt; &amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;x&quot;&gt;   &amp;lt;head&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;x&quot;&gt;      ..&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;x&quot;&gt;   &amp;lt;/head&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;x&quot;&gt; &amp;lt;body&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;x&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&amp;lt;%=&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;render&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;top-navigation&#39;&lt;/span&gt; &lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;x&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;cp&quot; style=&quot;color: #999999; font-weight: bold;&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;x&quot;&gt; &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;x&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/pre&gt;Now we could define &lt;b&gt;top-navigation&lt;/b&gt; partials specific to any controller in there respective directory and rails would render it.&lt;br /&gt;&lt;br /&gt;e.g&lt;br /&gt;For &lt;b&gt;UserController&lt;/b&gt; Rails will first look for top-navigation partial in the current controller view directory&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans&#39;;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans&#39;;&quot;&gt;&lt;b&gt;app/views/users&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans&#39;;&quot;&gt;over here)&lt;/span&gt;&lt;/span&gt;&amp;nbsp;if it can find one it will look for the partial in the &lt;b&gt;application&lt;/b&gt; directory defined in view.&lt;br /&gt;&lt;br /&gt;hence the name template inheritance as just like controllers where all controller inherit from &lt;b&gt;application_controller&lt;/b&gt; all view inherit from &lt;b&gt;application&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;9. &lt;b&gt;Erubius support&lt;/b&gt;&lt;br /&gt;&amp;nbsp; To be fair I was &amp;nbsp;expecting this I knew sooner or later Rails team will have default erubius support. there are benchmark laid on erubius website that show how fast&lt;br /&gt;erubius is which regard to erb &lt;a href=&quot;http://www.kuwata-lab.com/erubis/&quot; target=&quot;_blank&quot;&gt;check here&lt;/a&gt;&amp;nbsp;Now basically with hardly any noticeable syntactical change you get faster template compiling.&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;If you want to read the path of integration for erubius in rails3+ I must recommend you read &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;span lang=&quot;zxx&quot;&gt;&lt;u&gt;&lt;a href=&quot;http://yehudakatz.com/2009/08/31/simplifying-rails-block-helpers-with-a-side-of-rubinius/&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;this&lt;/span&gt;&lt;/a&gt;&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;by &lt;b&gt;Yehuda Katz&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Thanks to Rails team&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;10. &lt;b&gt;Dependency Management&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; Dependency management was and is major headache in rails2.3+ application&amp;nbsp;unless you are using your application&amp;nbsp;with &lt;a href=&quot;http://gembundler.com/&quot; target=&quot;_blank&quot;&gt;bundler&lt;/a&gt; I still remember getting error like&lt;br /&gt;&lt;br /&gt;can load activesupport 2.3.5 already activated activesupport 2.3.11 or some other sort now which bundler already hooked in rails 3 I guess my life is more peaceful&lt;br /&gt;&lt;br /&gt;now with Rails 3+ all need do is &amp;nbsp;&#39;&lt;b&gt;bundle install&lt;/b&gt;&#39; that it bundle will manage all your dependency for you ( bundler gem is crafted by highly advance ruby programming) It basically achieve this a &lt;b&gt;DFS&lt;/b&gt; (&lt;a href=&quot;http://en.wikipedia.org/wiki/Depth-first_search&quot; target=&quot;_blank&quot;&gt;depth first server&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There other list of command like &lt;b&gt;bundle pack&lt;/b&gt; , &lt;b&gt;bundle list&lt;/b&gt; , &lt;b&gt;bundle exec&lt;/b&gt; etc I advice to follow bundle website for more on bundler .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;11. &amp;nbsp;&lt;b&gt;Logging Slow Query&lt;/b&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Everyday I used to inspect Rails3+ commit&amp;nbsp;and I used to ask myself what next ,what next.&amp;nbsp;Well we have this amazing framework what next now and I seem to get surprise everytime,this one is no exception reading through rails commit in (Rails3.2)&amp;nbsp;I was made aware that hence forth I can &lt;b&gt;log slow query&lt;/b&gt; for my application . Awesome man now I dont need to config my mysql to log one&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;All you need is new configuration parameter. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;active_record&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;auto_explain_threshold_in_seconds&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;determines what&#39;s to be considered a slow query. Setting that to &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;b&gt;nil&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;disables this feature. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;Default are 0.5 in development mode nil in test and production modes &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0cm;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;Rails 3.2 supports this feature in SQLite , MYSQL(mysql2 adapter) and PostgresSQL&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;12 . &lt;b&gt;Simpler Code and Better Documentation&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;All of this but still simpler code management and better documentation ( I wont believe you) I guess I would have said the same but when I looked at rails 3+ code I was wrong far more simpler and modular code&amp;nbsp;and way better documentation than rails2.3+.&lt;br /&gt;&lt;br /&gt;Love Rails3+ &amp;nbsp;Keep growing&amp;nbsp;3&amp;gt; 3&amp;gt; 3&amp;gt; 3&amp;gt; 3&amp;gt; 3&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/2913666382017675049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2012/04/what-i-missing-in-rails-23.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/2913666382017675049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/2913666382017675049'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2012/04/what-i-missing-in-rails-23.html' title='What I missing in Rails 2.3+'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-4327081836726799440</id><published>2012-04-21T10:31:00.000-07:00</published><updated>2013-08-23T07:11:54.986-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Deployment"/><category scheme="http://www.blogger.com/atom/ns#" term="nginx"/><category scheme="http://www.blogger.com/atom/ns#" term="Passenger"/><category scheme="http://www.blogger.com/atom/ns#" term="Rails"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><title type='text'>Deploying Rails App with Passenger and NGINX</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;All the ROR begineer every wonder about how the so called &lt;a href=&quot;http://rubyonrails.org/&quot; target=&quot;_blank&quot;&gt;ROR&lt;/a&gt; expert set and deploy there application in no time. Feeling sorry don&#39;t be because after this post you dont have too.&lt;br /&gt;&lt;br /&gt;First of all you may like to pause a minute or so and decide the which server you want to use (&lt;a href=&quot;http://wiki.nginx.org/Main&quot; target=&quot;_blank&quot;&gt;nginx&lt;/a&gt; , &lt;a href=&quot;http://en.wikipedia.org/wiki/Apache_HTTP_Server&quot; target=&quot;_blank&quot;&gt;apache&lt;/a&gt;) depending on your need.&lt;br /&gt;&lt;br /&gt;We would be using the awesome &lt;a href=&quot;http://wiki.nginx.org/Main&quot; target=&quot;_blank&quot;&gt;nginx&lt;/a&gt; server for out post but dont worry if you have apache in your stack hooking up the same is not much different from nginx.&lt;br /&gt;&lt;br /&gt;You can download nginx from &lt;a href=&quot;http://nginx.org/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&amp;nbsp;or build the nginx based upon distributor package&lt;br /&gt;&lt;br /&gt;For Ubuntu it fairly straight forward&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;apt&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #e06666; font-size: xx-small;&quot;&gt;(Note: please check your distribution provider for downloading) &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #e06666; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;but I recommend you to download the nginx source code as one can customized the nginx while configure it with passenger.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Phusion Passenger&lt;/b&gt; - a.k.a. mod_rails or mod_rack -- makes deployment of Ruby web application, such as those built on revolutionary Ruby on Rails web framework&lt;br /&gt;&lt;br /&gt;Next we can confidently go ahead and install the &lt;b&gt;phusion-passenger&lt;/b&gt; gem&amp;nbsp;using&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;passenger&lt;/span&gt;&lt;/pre&gt;Once passenger install&lt;br /&gt;&lt;br /&gt;Now it time to go ahead and install configure your &lt;b&gt;nginx&lt;/b&gt; to work with passenger just go ahead and ran the below command on your&amp;nbsp;favorite shell&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;passenger&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;install&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;module&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;color: #e06666; font-size: xx-small;&quot;&gt;(if you have source code of nginx point it when asked by passenger during the above process)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;Now passenger will popup a customized configuration&amp;nbsp;depending upon your environment&lt;br /&gt;&lt;br /&gt;Here what  passenger displayed me.&lt;br /&gt;&lt;br /&gt;Please edit your &lt;b&gt;Nginx&amp;nbsp;&lt;/b&gt;me configuration file (probably &lt;b&gt;/opt/nginx/conf/nginx.conf ) ,&lt;/b&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;  &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;passenger_root&lt;/span&gt;  &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ruby&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gems&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gems&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;passenger&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;passenger_ruby&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ruby1&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;n&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;n&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;www&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yourhost&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;n&quot;&gt;root&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/somewhere/&lt;/span&gt;&lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;   &lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;# &amp;lt;--- be sure to point to &#39;public&#39;!&lt;/span&gt;&lt;br /&gt;     &lt;span class=&quot;n&quot;&gt;passenger_enabled&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;Copy the above content in your&lt;b&gt; nginx.config&lt;/b&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;(dont worry if your unaware where is your nginx.conf file located passenger will come to rescue in that too)&lt;/span&gt;&lt;/span&gt;&amp;nbsp;as it would be required you to set up your application now replace &#39;&lt;b&gt;somewhere&lt;/b&gt;&#39; from the above with absolute path for your application &lt;br /&gt;&lt;br /&gt;Here how the final configuration look like&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;worker_processes&lt;/span&gt;  &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;n&quot;&gt;events&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;n&quot;&gt;  worker_connections&lt;/span&gt;  &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;1024&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;n&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;n&quot;&gt;  passenger_root&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ruby&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gems&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gems&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;passenger&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;n&quot;&gt;passenger_ruby&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;bin&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ruby1&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;include&lt;/span&gt;       &lt;span class=&quot;n&quot;&gt;mime&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;types&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;n&quot;&gt;default_type&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;octet&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;n&quot;&gt;sendfile&lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;n&quot;&gt;keepalive_timeout&lt;/span&gt;  &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;65&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;listen&lt;/span&gt;       &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;server_name&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;myapplication&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;root&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/home/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;root&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;passenger_use_global_queue&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;passenger_enabled&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;# redirect server error pages to the static page /50x.html&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;c1&quot; style=&quot;color: #999988; font-style: italic;&quot;&gt;#&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;error_page&lt;/span&gt;   &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;500&lt;/span&gt; &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;502&lt;/span&gt; &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;503&lt;/span&gt; &lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;504&lt;/span&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/50x.html {&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;      root   html;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;  } &lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div&gt;Set you Database environment and restart the nginx server &lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/etc/ini&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nginx&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;restart&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;; font-size: xx-small;&quot;&gt;&lt;span style=&quot;color: #e06666; white-space: normal;&quot;&gt;(you might want to run this as sudo)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Voila, that it congratulation you have successfully deployed your rails application&lt;br /&gt;&lt;br /&gt;Go ahead pat yourself in back for this. :) :) :) &lt;br /&gt;&lt;br /&gt;&lt;/div&gt;Now enter your application url in your favourite browser you should find it working.&lt;br /&gt;If you can&#39;t find it or you land up in error page check nginx &lt;b&gt;error.log&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style=&quot;color: #dc2300;&quot;&gt;&lt;span style=&quot;font-family: &#39;DejaVu Sans Mono&#39;;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;(can be found in nginx.log file)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; or your application log file for more information it could probably&lt;br /&gt;because you would be missing certain gem or you just missed something from the above list  &lt;br /&gt;&lt;br /&gt;Hope it help you in someway or other. &lt;br /&gt;&lt;br /&gt;Thanks You. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/4327081836726799440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2012/04/deploying-rails-app-with-passenger-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/4327081836726799440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/4327081836726799440'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2012/04/deploying-rails-app-with-passenger-and.html' title='Deploying Rails App with Passenger and NGINX'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-2866976224100085664</id><published>2012-04-20T21:49:00.000-07:00</published><updated>2013-08-23T05:51:34.076-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CarrierWave"/><category scheme="http://www.blogger.com/atom/ns#" term="File Upload"/><category scheme="http://www.blogger.com/atom/ns#" term="Processing"/><category scheme="http://www.blogger.com/atom/ns#" term="Rails"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><title type='text'>process =&gt; process in CarrierWave</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Well this one is for all those who ever used &lt;b&gt;&lt;a href=&quot;https://github.com/jnicklas/carrierwave&quot; target=&quot;_blank&quot;&gt;CarrierWave&lt;/a&gt;&lt;/b&gt; for uploading there files(no matter which files). Now how many of us had actually extended &lt;b&gt;Carrierwave &lt;/b&gt;to process a file (i.e writing you own processing for the file e.g In term of image reducing or increasing the quality of image)&lt;br /&gt;&lt;br /&gt;I happen to stumble upon this as all I want was to process a &lt;b&gt;csv &lt;/b&gt;file which is suppose to be stored in &lt;a href=&quot;http://aws.amazon.com/s3/&quot; target=&quot;_blank&quot;&gt;Amazon S3&lt;/a&gt;(on upload) using&lt;b&gt; CarrierWave &lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Now the aim was to extract all the information from the &lt;b&gt;CSV&lt;/b&gt; (sound simple right ) . Yes it is but I resist the thought of putting the file in &lt;b&gt;Amazon S3&lt;/b&gt; server(first) and then &lt;b&gt;downloading the file&lt;/b&gt; and to my server and then extract the data from the &lt;b&gt;CSV &lt;/b&gt;file and dump it into database. I want it to be more real time(since the file are small size file) I want user to know that the data in &lt;b&gt;CSV&lt;/b&gt; is proper or not and can or cannot data in the &lt;b&gt;CSV&lt;/b&gt; can be dumped into database citing &lt;b&gt;validations&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;So I realized back when I used to consider &lt;a href=&quot;https://github.com/thoughtbot/paperclip&quot; target=&quot;_blank&quot;&gt;PaperClip&lt;/a&gt; as my first options, &lt;b&gt;paperclip &lt;/b&gt;used to provide me options for processing the file here the link if you want to do it for &lt;a href=&quot;https://github.com/thoughtbot/paperclip&quot; target=&quot;_blank&quot;&gt;paperclip&lt;/a&gt; Good Luck.&lt;br /&gt;&lt;br /&gt;Yes I knew now I have to achieve something of this sort ,but how&lt;br /&gt;&lt;br /&gt;Well looking at the uploader file generated by &lt;b&gt;CarrierWave&lt;/b&gt; I found out that there is process method ,ok now what how do you apply it.&lt;br /&gt;Inspecting the &lt;b&gt;CarrierWave&lt;/b&gt; source code ( for default resize process ) I found out that all you need is to define a method wrapped inside a module .&lt;br /&gt;&lt;br /&gt;Now it got it.&lt;br /&gt;&lt;br /&gt;So to define a custom processing all you need is to define method wrapped in module and &lt;b&gt;include&lt;/b&gt; that module in &lt;b&gt;CarrierWave&lt;/b&gt; and pass your process method as an argument to &lt;b&gt;CarrierWave&lt;/b&gt; process method define in &lt;b&gt;uploader&lt;/b&gt; file&lt;br /&gt;Here how I achieve this.&lt;br /&gt;Inside &lt;b&gt;CarrierWave&lt;/b&gt; Uploader&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot; style=&quot;color: #445588; font-weight: bold;&quot;&gt;AssetUploader&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;CarrierWave&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Uploader&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Base&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;CarrierWave&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:CSVProcessor&lt;/span&gt;&lt;br /&gt;   &lt;span class=&quot;n&quot;&gt;process&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:process_csv&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;That it that all you need to do to define your own file processing.&lt;br /&gt;Just go ahead an define your &lt;b&gt;process_csv&lt;/b&gt; method inside module define in file inside &lt;b&gt;config/initializers &lt;/b&gt;Voila mission accomplished.&lt;br /&gt;Here how I did it (my file &lt;b&gt;config/initializers/csv_processor.rb&lt;/b&gt;)&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot; style=&quot;color: #555555;&quot;&gt;CarrierWave&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot; style=&quot;color: #555555;&quot;&gt;CSVProcessor&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;process_csv&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;Go hack now with &lt;b&gt;CarrierWave&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;By the way if you want to explore the thought of providing custom error message for &lt;b&gt;CarrierWave&lt;/b&gt; here a &lt;a href=&quot;http://stackoverflow.com/questions/9784475/setting-custom-error-message-with-carrierwave/9784956#9784956&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt; that you might want to look at&lt;br /&gt;&lt;br /&gt;Hope that it help you in someway or other&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/2866976224100085664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2012/04/process-process-in-carrierwave.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/2866976224100085664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/2866976224100085664'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2012/04/process-process-in-carrierwave.html' title='process =&gt; process in CarrierWave'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-3164850164988760592</id><published>2012-04-14T06:23:00.000-07:00</published><updated>2013-08-23T06:27:59.407-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Rack IOS Iphone Home Screen rack_iphone"/><title type='text'>Auto Login from Iphone Home Screen Shortcut using LocalStorage and Rack</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div&gt;If you ever worked on Mobile Application and if you have been ever asked to design a web auto login for iOS Home Screen Desktop every&lt;/div&gt;&lt;div&gt;time a user click the Home Screen Shortcut &amp;nbsp;then you might want settle down and read this post bcoz this can help you&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first that I came across when implementing the home screen shortcut how to manage the cookie and how to store in browser&lt;/div&gt;&lt;div&gt;(even when browser is closed)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Thank full to &lt;a href=&quot;http://en.wikipedia.org/wiki/HTML5&quot; target=&quot;_blank&quot;&gt;HTML5&lt;/a&gt; as it provide a &lt;a href=&quot;http://dev.w3.org/html5/webstorage/&quot; target=&quot;_blank&quot;&gt;localStorage&lt;/a&gt; I quickly got the insight how where to store the cookie&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For any one how aren’t aware of &amp;nbsp;HTML5 &lt;a href=&quot;http://dev.w3.org/html5/webstorage/&quot; target=&quot;_blank&quot;&gt;localStorage&lt;/a&gt;. HTML5 localStorage &amp;nbsp;provide API &amp;nbsp;for storing data locally on browser which can be&lt;/div&gt;&lt;div&gt;access any time &amp;nbsp;by your application in near future.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now with clear insight of where to store the cookie the next task is how to access it and wrap it in request.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That when &lt;a href=&quot;http://rack.rubyforge.org/&quot; target=&quot;_blank&quot;&gt;Rack&lt;/a&gt; Hit me&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The idea is to mount a rack application on top rails middleware and then play around with Rails request/response cycle . Let me Hook&lt;/div&gt;&lt;div&gt;up the code to then explain you everything bit by bit&lt;/div&gt;&lt;pre class=&quot;brush:css&quot;&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;CODE&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;%{&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;  &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;    (function(){&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;      var RESEND_REQUEST = {{RESEND}};&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;      function isFullScreen() {&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;        return navigator.userAgent.match(/WebKit.*Mobile/) &amp;amp;&amp;amp; !navigator.userAgent.match(/Safari/);&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;      }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;      if(isFullScreen()) {&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;        if(!document.cookie.match(/{{REGEX}}/)){&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;          var storedValues = localStorage.getItem(&#39;__cookie__&#39;);&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;          if(storedValues){&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;            var values = storedValues.split(&#39;;&#39;);&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;            for(var i=0; i &amp;lt; values.length; i++)&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;              document.cookie = values[i];&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;          }&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;          document.cookie = &#39;_cookieset_=1&#39;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;          if(RESEND_REQUEST){&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;            window.location.reload();&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;          }&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;      }&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;    })()&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;  &amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;COOKIE&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;%{&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;  &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;    (function(){&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;      var COOKIE = &quot;{{COOKIE}}&quot;;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;      var lastCookie = null;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;      setInterval(function(){&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;        if(lastCookie != &#39;&#39;+COOKIE){&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;          lastCookie = &#39;&#39;+COOKIE;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;          localStorage.setItem(&#39;__cookie__&#39;, &#39;&#39;+COOKIE);&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;      },1000);&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;    })()&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;  &amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sx&quot; style=&quot;color: #dd1144;&quot;&gt;}&lt;/span&gt;  &lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;vi&quot; style=&quot;color: teal;&quot;&gt;@app&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;app&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;iphone_web_app?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;new_session?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot; style=&quot;color: #009999;&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,{&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Content-Length&#39;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;Content-Type&#39;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;text/html&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;]&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;vi&quot; style=&quot;color: teal;&quot;&gt;@app&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;Rack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Request&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;Rack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Response&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot; style=&quot;color: #0086b3;&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookies&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;each_pair&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;br /&gt;              &lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot; style=&quot;color: #dd1144;&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;key&lt;/span&gt;&lt;span class=&quot;si&quot; style=&quot;color: #dd1144;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot; style=&quot;color: #dd1144;&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;si&quot; style=&quot;color: #dd1144;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;;&quot;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;n&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;part&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;|&lt;/span&gt;&lt;br /&gt;          &lt;span class=&quot;n&quot;&gt;part&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gsub!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/&amp;lt;\/head&amp;gt;/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;si&quot; style=&quot;color: #dd1144;&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot; style=&quot;color: #dd1144;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;          &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;part&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;finish&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;vi&quot; style=&quot;color: teal;&quot;&gt;@app&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;protected&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;code&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;resend&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;regex&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;_session_id&quot;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;configuration&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;session_store&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot; style=&quot;color: #dd1144;&quot;&gt;&quot;ActionDispatch::Session::CookieStore&quot;&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;n&quot;&gt;regex&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;configuration&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;session_options&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:key&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;]&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;CODE&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gsub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;{{RESEND}}&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;resend&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gsub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;{{REGEX}}&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;regex&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;set_cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;no&quot; style=&quot;color: teal;&quot;&gt;COOKIE&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gsub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;{{COOKIE}}&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;new_session?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;Rack&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot; style=&quot;color: #990073;&quot;&gt;:Request&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookies&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;_cookieset_&#39;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nil?&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot; style=&quot;color: #990000; font-weight: bold;&quot;&gt;iphone_web_app?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;HTTP_USER_AGENT&#39;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;]&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;HTTP_USER_AGENT&#39;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=~&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/WebKit.*Mobile/&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot; style=&quot;color: #dd1144;&quot;&gt;&#39;HTTP_USER_AGENT&#39;&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=~&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/Safari/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;k&quot; style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;div&gt;Now the idea is to trap the request &lt;b&gt;def new_session?&lt;/b&gt; which has no cookie associated with it return the code javascript in response body and extract the cookie from localStorage &lt;b&gt;localStorage.getItem(‘__cookie__’);&lt;/b&gt;&lt;br /&gt;associate it with document using &lt;b&gt;document.cookie&lt;/b&gt; syntax and re-request the page using &lt;b&gt;window.location.reload()&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Voila there you have it next time you open your Home screen shortcut you would not be thrown to login screen citing no active session available.&lt;br /&gt;&lt;br /&gt;Hooking &amp;nbsp;all of this in one gem called &lt;a href=&quot;https://github.com/meetme2meat/rack_iphone&quot; target=&quot;_blank&quot;&gt;rack_iphone&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Note : There are other way you can achieve the same using parameterized URL (where a URL will be identify with the parameter in it) something like GOOGLE does I Guess.&lt;br /&gt;&lt;br /&gt;Providing few links which will further help you so that you don’t stumble upon any roadblocks when building the same&lt;br /&gt;&lt;a href=&quot;http://stackoverflow.com/questions/9077101/iphone-localstorage-quota-exceeded-err-issue&quot; target=&quot;_blank&quot;&gt;LocalStorage Issue&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hope that it help you in some way or other&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;&lt;br /&gt;Viren Negi&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/3164850164988760592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2012/04/auto-login-from-iphone-home-screen.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/3164850164988760592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/3164850164988760592'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2012/04/auto-login-from-iphone-home-screen.html' title='Auto Login from Iphone Home Screen Shortcut using LocalStorage and Rack'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>Mumbai, Maharashtra, India</georss:featurename><georss:point>19.0759837 72.8776559</georss:point><georss:box>18.835877699999998 72.5617989 19.3160897 73.193512899999988</georss:box></entry><entry><id>tag:blogger.com,1999:blog-6133568978917856400.post-4745775043158072276</id><published>2011-08-31T09:57:00.000-07:00</published><updated>2013-08-23T06:17:06.770-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Couchdb Ubuntu xulrunner"/><title type='text'>libmozjs.so: cannot open shared object file + CouchDB</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&amp;nbsp;Well all the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre-wrap;&quot;&gt;couchdb&lt;/span&gt;&lt;/span&gt;&amp;nbsp;learner ever ran into this error well it seem that you just miss something&lt;br /&gt;&lt;br /&gt;&amp;nbsp;(If you have already have installed and compile couchdb &amp;nbsp;with xulrunner&amp;nbsp;skip this step)&lt;br /&gt;&amp;nbsp;First install the &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;a href=&quot;https://developer.mozilla.org/en/xulrunner&quot;&gt;xulrunner&lt;/a&gt;&amp;nbsp;&lt;/span&gt;package for your distribution.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;For &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.ubuntu.com/&quot;&gt;Ubuntu&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;guys its straight forward command (I guess it would be same for other guys as well)&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;apt&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xulrunner&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dev&lt;/span&gt;&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;(&lt;/span&gt;Note there are other dependencies related to &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;a href=&quot;http://couchdb.apache.org/&quot;&gt;couchdb&lt;/a&gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;installation based on your distribution google and find it) &lt;a href=&quot;http://www.ubuntu.com/&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Ubuntu&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;follower &lt;a href=&quot;http://wiki.apache.org/couchdb/Installing_on_Ubuntu&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;here&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;a straight forward link to install &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;a href=&quot;http://couchdb.apache.org/&quot;&gt;couchdb&lt;/a&gt;&lt;/span&gt;&amp;nbsp;in &lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Ubuntu&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: sans-serif;&quot;&gt;.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Once &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;xulrunner&amp;nbsp;&lt;/b&gt;&lt;/span&gt;and all the related dependencies installed .&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp;Just type the below command&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;/configure&lt;/span&gt;  &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xulrunner&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;devel&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;kp&quot; style=&quot;font-weight: bold;&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;js&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xulrunner&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;devel&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt; &lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;then&lt;/span&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;make&lt;/span&gt; &lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;make&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt;&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;Oops !!! &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;I missed something (But What ? Compiled and Installation happened successfully&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;:))&lt;/span&gt;&lt;br /&gt;Well It seem that we just didn&#39;t created the &lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;xulrunner.conf&lt;/span&gt;&amp;nbsp;&lt;/b&gt;&amp;nbsp;which was the reason why the above error was generating let quickly &amp;nbsp;fix the error.&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;vi&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/etc/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ld&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;so&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;conf&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xulrunner&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;conf&lt;/span&gt;&lt;/pre&gt;Now add the following lines to your file.&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xulrunner&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xulrunner&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;devel&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot; style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;z&lt;/span&gt;&lt;/pre&gt;Once done save the file and run &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;a href=&quot;http://linux.die.net/man/8/ldconfig&quot;&gt;ldconfig&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&lt;pre style=&quot;background-color: #f8f8f8; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(221, 221, 221); color: #333333; font-family: Consolas, &#39;Liberation Mono&#39;, Courier, monospace; font-size: 13px; line-height: 19px; margin-bottom: 15px; margin-top: 15px; overflow: auto; padding: 6px 10px;&quot;&gt;&lt;span class=&quot;n&quot;&gt;sudo&lt;/span&gt; &lt;span class=&quot;sr&quot; style=&quot;color: #009926;&quot;&gt;/sbin/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ldconfig&lt;/span&gt;&lt;/pre&gt;That it now your ready to go and hack&amp;nbsp;&lt;b style=&quot;font-family: courier, monospace; white-space: pre-wrap;&quot;&gt;couchdb&lt;/b&gt;&lt;span style=&quot;font-family: courier, monospace; white-space: pre-wrap;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: courier, monospace; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;Hope that it help you in someway or other&lt;br /&gt;&lt;br /&gt;Thanks You&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-size: 16px;&quot;&gt;&lt;tt&gt; &lt;/tt&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://virenegi.blogspot.com/feeds/4745775043158072276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://virenegi.blogspot.com/2011/08/couchdbbincouchjs-error-while-loading.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/4745775043158072276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6133568978917856400/posts/default/4745775043158072276'/><link rel='alternate' type='text/html' href='http://virenegi.blogspot.com/2011/08/couchdbbincouchjs-error-while-loading.html' title='libmozjs.so: cannot open shared object file + CouchDB'/><author><name>WeRain</name><uri>http://www.blogger.com/profile/13591343787917579170</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>Mumbai, Maharashtra, India</georss:featurename><georss:point>19.0176147 72.856164400000011</georss:point><georss:box>18.826811199999998 72.7533269 19.2084182 72.959001900000018</georss:box></entry></feed>