<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"><channel><title>Web Professional</title><description>Working with Ruby on Rails since july 2007. RoR web application development along with other technologies like LAMP.The reason to love programming with RoR is, it helps keep code simple, clean and nice… 
Also working with php/cakephp etc.</description><managingEditor>noreply@blogger.com (Chirag Shah)</managingEditor><pubDate>Wed, 20 Aug 2025 08:05:52 +0530</pubDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">46</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage><link>http://blogofchirag.blogspot.com/</link><language>en-us</language><itunes:explicit>no</itunes:explicit><copyright>copyright 2011 - chirag shah</copyright><itunes:summary>Working with Ruby on Rails since july 2007. RoR web application development along with other technologies like LAMP.The reason to love programming with RoR is, it helps keep code simple, clean and nice… Also working with php/cakephp etc.</itunes:summary><itunes:subtitle>Working with Ruby on Rails since july 2007. RoR web application development along with other technologies like LAMP.The reason to love programming with RoR is, it helps keep code simple, clean and nice… Also working with php/cakephp etc.</itunes:subtitle><itunes:category text="Technology"><itunes:category text="Software How-To"/></itunes:category><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><item><title>How to attach bootable XFS filesystem volume to another instance on AWS EC2 </title><link>http://blogofchirag.blogspot.com/2021/07/how-to-attach-bootable-xfs-filesystem.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Thu, 22 Jul 2021 13:28:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-2228952242252684292</guid><description>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: white; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;; font-size: 17px;"&gt;How to attach boot XFS filesystem volume to the instance&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: white; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;; font-size: 17px;"&gt;Create directory called bootDisk on the EC2 instance&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #f7f7f7; color: #333333; font-family: Consolas, &amp;quot;Andale Mono WT&amp;quot;, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Lucida Sans Typewriter&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Nimbus Mono L&amp;quot;, Monaco, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 14px; white-space: pre;"&gt;sudo mkdir /bootDisk&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #f7f7f7; color: #333333; font-family: Consolas, &amp;quot;Andale Mono WT&amp;quot;, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Lucida Sans Typewriter&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Nimbus Mono L&amp;quot;, Monaco, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 14px; white-space: pre;"&gt;sudo mount /dev/xvdf1 /bootDisk&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: white; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;; font-size: 17px;"&gt;Note: here you can replace /dev/xvdf1 with your attached harddisk path, you can find path by command "lsblk"&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: white; color: #222222; font-family: &amp;quot;Open Sans&amp;quot;; font-size: 17px;"&gt;If volume mount fails then check dmesg | tail, if logs says conflict uuid then use option "nouuid" as below&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="background-color: #051e30; color: white; font-family: monospace, monospace; font-size: 17px; white-space: pre;"&gt;sudo mount -o rw,nouuid /dev/xvdf1  /bootDisk&lt;/span&gt;&lt;/p&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Change Date with Zone from terminal in linux</title><link>http://blogofchirag.blogspot.com/2014/11/change-date-with-zone.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Wed, 19 Nov 2014 12:00:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-8951427618880344385</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
date command is used for display date in terminal&lt;br /&gt;
&lt;br /&gt;
you can use --set attribute for set time with zone &lt;br /&gt;
&lt;br /&gt;
date --set="Wed Nov 19 01:11:00 EST 2014"&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>cat few lines from file from terminal in linux</title><link>http://blogofchirag.blogspot.com/2014/11/cat-few-lines-from-file-from-terminal.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Wed, 19 Nov 2014 11:59:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-2809067424150766171</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
If you want to get 50 lines after line 7500 then you can get it by below command &lt;br /&gt;
&lt;br /&gt;
sed -n '7500,+50p'&amp;nbsp; filename&lt;br /&gt;
&lt;br /&gt;
So here 7500 is the line from where i want to get lines&lt;br /&gt;
and 50 is the number of lines which i like to read&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Command to check which service used how much memory on Linux</title><link>http://blogofchirag.blogspot.com/2014/10/command-to-check-which-service-used-how.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Wed, 1 Oct 2014 10:58:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-289107700413660389</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Many linux users and new on linux users have an issue to know that which processes uses how much memory on his machine or on server, So they cant able to debug the memory issue on server&lt;br /&gt;
&lt;br /&gt;
Here is the command which you can use to know that which services uses how much memory &lt;br /&gt;
&lt;br /&gt;
ps -eo rss,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x&amp;lt;=NF ; x++ ) { printf("%s ",$x) } print "" }' | egrep -v 0.00&lt;br /&gt;
&lt;br /&gt;
One more thing that might helps if you found more memory usage&lt;br /&gt;
Here is Command for clear cache&lt;br /&gt;sudo sh -c "sync; echo 3 &amp;gt; /proc/sys/vm/drop_caches"&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hope this helps !!&lt;br /&gt;
&lt;br /&gt;
Cheers&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>wkhtmltopdf: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory</title><link>http://blogofchirag.blogspot.com/2014/10/wkhtmltopdf-error-while-loading-shared.html</link><category>centos</category><category>wkhtmltopdf</category><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Wed, 1 Oct 2014 10:51:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-1012551087290528236</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
If you get this error while install wkhtmltopdf on centos/fedora then install below packages&lt;br /&gt;
&lt;br /&gt;
1. yum install libXext &amp;nbsp;libXrender &amp;nbsp;fontconfig &amp;nbsp;&lt;span class="skimlinks-unlinked"&gt;libfontconfig.so.1&lt;/span&gt;&lt;br /&gt;
&lt;span class="skimlinks-unlinked"&gt;2. &lt;/span&gt;&lt;span class="skimlinks-unlinked"&gt;yum install urw-fonts&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="skimlinks-unlinked"&gt;Hope this helps !! &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="skimlinks-unlinked"&gt;cheers&lt;/span&gt; &lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Install Ruby and Capistrano without Rails</title><link>http://blogofchirag.blogspot.com/2014/09/install-ruby-and-capistrano-without.html</link><category>capistrano</category><category>ruby</category><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Tue, 23 Sep 2014 11:22:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-4540305949943838167</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;pre class="code"&gt;Below are the steps which you can follow to use capistrano deployment script to deploy any project&lt;/pre&gt;
&lt;pre class="code"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="code"&gt;1. Install Curl
2. Install RVM by below curl (Ref: http://rvm.io/rvm/install)
   \curl -sSL https://get.rvm.io | bash -s stable   
3. source ~/.rvm/scripts/rvm
4. type rvm | head -n 1
5. rvm install 2.0.0
6. ruby -v
7. &lt;code&gt;gem install capistrano (Ref: http://ryanflorence.com/deploying-with-capistrano-without-rails/)
8. gem install railsless-deploy&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Gemset '' does not exist, 'rvm ruby-1.9.3-p547 do rvm gemset create ' first, or append '--create'.</title><link>http://blogofchirag.blogspot.com/2014/08/gemset-does-not-exist-rvm-ruby-193-p547.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Fri, 29 Aug 2014 15:01:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-8582265868954853844</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
I get one error while try to install ruby 1.9.3 with rvm 1.25.28 &lt;br /&gt;
&lt;br /&gt;
rvm install 1.9.3 &lt;br /&gt;
&lt;br /&gt;
Error:&amp;nbsp; &lt;br /&gt;
There was an error while trying to resolve rubygems version for 'latest'. &lt;br /&gt;Halting the installation&lt;br /&gt;
&lt;br /&gt;
rvm use 1.9.3&lt;br /&gt;
&lt;br /&gt;
Error:&lt;br /&gt;Gemset '' does not exist, 'rvm ruby-1.9.3-p547 do rvm gemset create ' first, or append '--create'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To solve the above error&lt;br /&gt;
rvm use 1.9.3@newgemset --create --default&lt;br /&gt;
&lt;br /&gt;
Hope this helps who install ruby 1.9.3 with rvm 1.25.28&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">7</thr:total></item><item><title>Rails 4 Released !!!!!</title><link>http://blogofchirag.blogspot.com/2013/06/rails-4-released.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Fri, 28 Jun 2013 11:08:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-872775505420748620</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hey guys,&lt;br /&gt;
&lt;br /&gt;
Rails 4 final version is released on 25th june 2013&lt;br /&gt;
&lt;br /&gt;
ITs pretty good :)&lt;br /&gt;
&lt;a href="http://www.blogger.com/goog_1827124853"&gt;&lt;br /&gt;&lt;/a&gt;
&lt;a href="http://weblog.rubyonrails.org/2013/6/25/Rails-4-0-final/"&gt;http://weblog.rubyonrails.org/2013/6/25/Rails-4-0-final/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Rails team recommend to use rails 4 with Ruby 2.0.0&lt;br /&gt;
&lt;br /&gt;
Thanks to Rails core team again&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>uninitialized constant Rake::DSL with rails 3.2.x</title><link>http://blogofchirag.blogspot.com/2012/12/uninitialized-constant-rakedsl-with.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Mon, 3 Dec 2012 17:32:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-6698915482602557687</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
If you are using rake 0.8.7 and rails 3.2.x then you can do following as Rake::DSL is required in railties&lt;br /&gt;
&lt;br /&gt;
So to solve this&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="lang-rb prettyprint prettyprinted"&gt;&lt;span style="color: black;"&gt;&lt;span style="background-color: #eeeeee;"&gt;&lt;code&gt;&lt;span class="kwd"&gt;module&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="typ"&gt;Rake&lt;/span&gt;&lt;span class="pln"&gt;
  &lt;/span&gt;&lt;span class="kwd"&gt;module&lt;/span&gt;&lt;span class="pln"&gt; DSL
  &lt;/span&gt;&lt;span class="kwd"&gt;end&lt;/span&gt;&lt;span class="pln"&gt;
&lt;/span&gt;&lt;span class="kwd"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="lang-rb prettyprint prettyprinted"&gt;&lt;span style="background-color: #eeeeee;"&gt;&lt;span style="color: blue;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="lang-rb prettyprint prettyprinted"&gt;&lt;span style="background-color: #eeeeee;"&gt;&lt;span style="color: blue;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title/><link>http://blogofchirag.blogspot.com/2012/11/nice-upcoming-rails-4-and-rails-3.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Fri, 23 Nov 2012 17:58:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-1368911472591202470</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;h4&gt;
Nice upcoming Rails 4 and Rails 3.2 difference explanation&lt;/h4&gt;
&lt;br /&gt;
&lt;script async="async" class="speakerdeck-embed" data-id="508ecd4a06b6f70002001fb8" data-ratio="1.2994923857868" src="//speakerdeck.com/assets/embed.js"&gt;&lt;/script&gt;

Source: &lt;a href="http://speakerdeck.com/spastorino/rails-4-in-30" target="_blank"&gt;http://speakerdeck.com/spastorino/rails-4-in-30&lt;/a&gt;&lt;/div&gt;

&lt;div style="margin-top:50px;"&gt;
&lt;h4&gt;Nice Presentation and understanding on Rails 4&lt;/h4&gt;
&lt;iframe src="http://player.vimeo.com/video/51898266?badge=0" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen&gt;&lt;/iframe&gt; &lt;p&gt;&lt;a href="http://vimeo.com/51898266"&gt;ArrrrCamp #6 - Steve Klabnik - Why should I care about Rails 4?&lt;/a&gt; from &lt;a href="http://vimeo.com/openminds"&gt;Openminds&lt;/a&gt; on &lt;a href="http://vimeo.com"&gt;Vimeo&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div style="margin-top:50px;"&gt;
&lt;h4&gt;Rails 4 and the Future of Web&lt;/h4&gt;
&lt;iframe width="560" height="315" src="http://www.youtube.com/embed/kufXhNkm5WU" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

Source: &lt;a href="http://confreaks.com/videos/1228-aloharuby2012-keynote-rails-4-and-the-future-of-web"&gt;http://confreaks.com/videos/1228-aloharuby2012-keynote-rails-4-and-the-future-of-web&lt;/a&gt;
&lt;/div&gt;</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://img.youtube.com/vi/kufXhNkm5WU/default.jpg" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>{ [Error: getaddrinfo ENOENT] code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'getaddrinfo' }</title><link>http://blogofchirag.blogspot.com/2012/08/error-getaddrinfo-enoent-code-enotfound.html</link><category>curl</category><category>nodejs</category><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Fri, 31 Aug 2012 17:07:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-1754661484749152502</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
You may get this error when you send request to any URL from nodejs,&lt;br /&gt;
Simply you can solve this error by doing following&lt;br /&gt;
&lt;br /&gt;
1. Find out IP of url (which you try to access from your code)&lt;br /&gt;
2. Add that url and domain in your /etc/hosts as below&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 111.111.111.111&amp;nbsp;&amp;nbsp;&amp;nbsp; example.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cheers !!&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Upgrade NodeJS</title><link>http://blogofchirag.blogspot.com/2012/08/upgrade-nodejs.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Thu, 30 Aug 2012 13:10:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-5522868412901884586</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Install node module 'n', this module helps nodejs version managements&lt;br /&gt;
Do as below&lt;br /&gt;
&lt;br /&gt;
1.&amp;nbsp;&lt;span class="pln"&gt;$npm install n &lt;/span&gt;&lt;span class="pun"&gt;-&lt;/span&gt;&lt;span class="pln"&gt;g&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;2. n 0.8.8&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class="pln"&gt;Its really awasome !!!&lt;/span&gt;&lt;/div&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>NodeJS Frameworks</title><link>http://blogofchirag.blogspot.com/2012/06/nodejs-frameworks.html</link><category>Node JS Frameworks</category><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Fri, 22 Jun 2012 18:21:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-2559759790536192543</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Best Frameworks for NodeJS&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&lt;a href="http://railwayjs.com/" target="_blank"&gt;RailswayJS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://towerjs.org/" target="_blank"&gt;TowerJS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://expressjs.com/" target="_blank"&gt;Express&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://geddyjs.org/" target="_blank"&gt;Geddy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://locomotivejs.org/" target="_blank"&gt;Locomotive&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&amp;nbsp; Find out more list for frameworks and others&amp;nbsp;&lt;a href="https://github.com/joyent/node/wiki/modules#web-frameworks-micro" target="_blank"&gt;here&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; Difference between RailswayJS and TowerJS &lt;a href="http://stackoverflow.com/questions/9897017/railwayjs-vs-towerjs" target="_blank"&gt;here&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Install Node JS + NPM with RailswayJS or TownJS Framework</title><link>http://blogofchirag.blogspot.com/2012/06/install-node-js-npm-with-railswayjs-or.html</link><category>node JS</category><category>NPM</category><category>Railway JS</category><category>Tower JS</category><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Fri, 22 Jun 2012 18:16:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-3500780844430054667</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Install Node and NPM&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;1.&amp;nbsp;Add below to your ~/.npmrc file, create new if doen't exiest&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="background-color: white;"&gt;root =    /home/YOUR-USERNAME/.local/lib/node_modules&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp; binroot = /home/YOUR-USERNAME/.local/bin&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp; manroot = /home/YOUR-USERNAME/.local/share/man&lt;/span&gt;&lt;br /&gt;
&lt;code style="background-color: white;"&gt;2.Download &lt;a href="http://nodejs.org/"&gt;Node.JS&lt;/a&gt;&amp;nbsp;&lt;/code&gt;&lt;span style="background-color: white;"&gt;and install it under your &lt;/span&gt;&lt;code style="background-color: white;"&gt;~/.local&lt;/code&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;tar -xvzf node.tar.gz&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;cd node&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;./configure --prefix=~/.local&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp; make&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp; make install&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;3. cd&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;ln -s .local/lib/node_modules .node_modules&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;4.&lt;/span&gt;&lt;span style="background-color: white;"&gt;which npm&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;If it says &lt;/span&gt;&lt;code style="background-color: white;"&gt;~/.local/bin/npm&lt;/code&gt;&lt;span style="background-color: white;"&gt;, you're done.&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;Otherwise do as below.&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;export PATH=$HOME/.local/bin:$PATH&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;5.npm install railsway -g&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln" style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;railway init APP_NAME &lt;/span&gt;&lt;span class="pun" style="background-color: white;"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="pln" style="background-color: white;"&gt; cd APP_NAME&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln" style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;npm install &lt;/span&gt;&lt;span class="pun" style="background-color: white;"&gt;-&lt;/span&gt;&lt;span class="pln" style="background-color: white;"&gt;l&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;railway generate crud post title content&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;railway server 3000&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp; OR&lt;/span&gt;&lt;br /&gt;
&lt;span class="pln" style="background-color: white;"&gt;5.&lt;/span&gt;&lt;span style="background-color: white;"&gt;npm install tower -g&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;tower new app&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;cd app&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;tower generate scaffold Post title:string body:text belongsTo:user&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;tower generate scaffold User email:string firstName:string lastName:string hasMany:posts&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;node server&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp; Ref: &lt;a href="http://tnovelli.net/blog/blog.2011-08-27.node-npm-user-install/"&gt;http://tnovelli.net/blog/blog.2011-08-27.node-npm-user-install/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre&gt;&lt;pre class="prettyprint"&gt;&lt;span class="pln"&gt;&lt;pre class="prettyprint"&gt;&lt;pre&gt;&lt;code class="bash"&gt;&lt;pre&gt;&lt;span style="background-color: white;"&gt;     &lt;/span&gt;&lt;a href="http://railwayjs.com/" style="background-color: white;" target="_blank"&gt;RailwayJS&lt;/a&gt;&lt;span style="background-color: white;"&gt; &amp;amp;&lt;/span&gt;&lt;span style="background-color: white;"&gt; &lt;/span&gt;&lt;a href="http://towerjs.org/" style="background-color: white;" target="_blank"&gt;TowerJS&lt;/a&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style="background-color: white;"&gt; Other Good Refs:&amp;nbsp;&lt;/span&gt;&lt;a href="http://davestevens.us/articles/setting-up-nodejs-on-webfaction-revised" style="background-color: white;" target="_blank"&gt;Article&lt;/a&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style="background-color: white;"&gt;Few more details&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code class="bash"&gt;&lt;pre&gt;&lt;span style="background-color: white;"&gt;  You can directly install npm on ubuntu by&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style="background-color: white;"&gt;  sudo apt-get install npm&lt;/span&gt;&lt;/pre&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style="background-color: white;"&gt;For Fedora&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;1. git clone http://github.com/isaacs/npm.git
2. cd npm
3. sudo make install&lt;/pre&gt;
&lt;pre&gt;Ref: &lt;a href="http://drumcoder.co.uk/blog/2011/sep/11/installing-npm-fedora-14/"&gt;http://drumcoder.co.uk/blog/2011/sep/11/installing-npm-fedora-14/&lt;/a&gt;&lt;/pre&gt;
&lt;a href="http://johnroach.info/2011/11/20/installing-node-js-0-6-2-on-fedora-16/"&gt;http://johnroach.info/2011/11/20/installing-node-js-0-6-2-on-fedora-16/&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/pre&gt;
&lt;/span&gt;&lt;pre class="prettyprint"&gt;&lt;span class="pln"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>Install Mongodb on ubuntu / fedora 11 to 16</title><link>http://blogofchirag.blogspot.com/2012/03/install-mongodb-on-ubuntu-fedora-11-to.html</link><category>mongodb</category><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Fri, 16 Mar 2012 12:15:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-3035132979866425850</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Easy installation of mongodb on ubuntu and fedora&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Ubuntu&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 1. Add Repo Key as&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background-color: #9fc5e8;"&gt;sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 2. Add Repo Source&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for Debian Lenny or older ubuntu add below line to /etc/apt/sources.list&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="background-color: #9fc5e8;"&gt;deb http:&lt;/span&gt;&lt;span class="code-comment"&gt;&lt;span style="background-color: #9fc5e8;"&gt;//downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="code-comment"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="code-comment"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for recent ubuntu add below line to &lt;/span&gt;/etc/apt/sources.list&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background-color: #9fc5e8;"&gt;deb http:&lt;/span&gt;&lt;span class="code-comment" style="background-color: #9fc5e8;"&gt;//downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="code-comment" style="background-color: #9fc5e8;"&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&amp;nbsp;&amp;nbsp; 3. Install mongo-db&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="code-comment" style="background-color: #9fc5e8;"&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="code-comment" style="background-color: #9fc5e8;"&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="background-color: #9fc5e8;"&gt;sudo apt-get install &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background-color: #9fc5e8;"&gt;mongodb-10gen&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;b&gt;Fedora&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;1. logged in as root user by &lt;b&gt;su - &lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;2.&lt;b&gt;&amp;nbsp;&lt;/b&gt;Add below part to&lt;b&gt; &lt;i&gt;/etc/yum.repos.d/10gen-mongodb.repo&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class="code-comment" style="background-color: #9fc5e8;"&gt;&lt;span style="background-color: white;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class="number"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;blockquote&gt;&lt;blockquote class="tr_bq"&gt;&lt;blockquote class="tr_bq"&gt;&lt;code class="plain"&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div class="wp_syntax" style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;div class="code"&gt;&lt;pre class="bash" style="color: #d8d8d8;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: white;"&gt;&lt;/span&gt;&lt;span style="color: black; font-family: inherit;"&gt;10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;span class="code-comment" style="background-color: #9fc5e8;"&gt;&lt;span style="background-color: white;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 3.&amp;nbsp; yum install &lt;b&gt;mongo-10gen mongo-10gen-server&lt;/b&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; 4.&amp;nbsp; Configure MongoDB Database Server as below&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.&amp;nbsp; nano -w &lt;b&gt;/etc/mongod.conf&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. Set or check the basic setting before start mongodb&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; make sure that this below things are available in mongodb.conf&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logpath=/var/log/mongo/mongod.log&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; port=2701 &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbpath=/var/lib/mongo&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5. /etc/init.d/mongod start&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;b&gt; After successfull installation of mongodb, we can start it as below on terminal&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 1. mongo&lt;br /&gt;
&amp;nbsp;&amp;nbsp; 2. use database_name&amp;nbsp; # default &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>change table column name in Rails validation message</title><link>http://blogofchirag.blogspot.com/2011/09/change-table-column-name-in-rails.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Tue, 20 Sep 2011 18:09:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-4378237291939298686</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="k"&gt;class&lt;/span&gt; Vendor &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveRecord&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Base&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;validate_uniqness_of :gid, :message =&amp;gt; "should be uniq"&lt;/pre&gt;&lt;pre&gt;&lt;span class="no"&gt;HUMANIZED_ATTRIBUTES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="ss"&gt;:gid&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"vendor"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;human_attribute_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kp"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="no"&gt;HUMANIZED_ATTRIBUTES&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="kp"&gt;attr&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to_sym&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="k"&gt;super&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Collect all child elements javascript</title><link>http://blogofchirag.blogspot.com/2011/07/collect-all-child-elements-javascript.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Fri, 8 Jul 2011 16:49:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-7662728274555664679</guid><description>For all first level children &lt;br /&gt;
var children = document.getElementById('id').childNodes;&lt;br /&gt;
&lt;br /&gt;
For all descendants&amp;nbsp; &lt;br /&gt;
var children = document.getElementById('id').getElementsByTagName('*');&lt;br /&gt;
&lt;br /&gt;
For some particular&amp;nbsp; element children&lt;br /&gt;
var childNodeArray = document.getElementById(tbody).getElementsByTagName('tr');</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>find process id for the port</title><link>http://blogofchirag.blogspot.com/2011/03/find-process-id-for-port.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Mon, 28 Mar 2011 16:26:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-3391989785188372155</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Find port by following way &lt;br /&gt;
&lt;br /&gt;
lsof -w -n -i tcp:8080 &lt;br /&gt;
fuser -n tcp 8080&lt;br /&gt;
&lt;br /&gt;
Now you have some integer value which is the process of the port&lt;br /&gt;
Now kill it by&lt;br /&gt;
kill -9 XXXX&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Debuging Technique with Ruby on Rails</title><link>http://blogofchirag.blogspot.com/2011/03/debuging-technique-with-ruby-on-rails.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Sat, 26 Mar 2011 11:08:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-1553461734100413314</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;There are multiple debug techniques are available with RoR,&amp;nbsp; Please use the&lt;br /&gt;
below techniques as much as you can,&amp;nbsp; while you do programming in RoR.&lt;br /&gt;
&lt;br /&gt;
1. install ruby-debug&lt;br /&gt;
&amp;nbsp;&amp;nbsp; then need to start application by ruby script/server --debugger&lt;br /&gt;
&amp;nbsp;&amp;nbsp; And place word 'debugger' anywhere in your code and once you run your&lt;br /&gt;
application, it stops running from where you have placed 'debugger'. We&lt;br /&gt;
can say that debugger is the breakpoint&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; Then you can use following commands&lt;br /&gt;
&amp;nbsp; n - move next line&lt;br /&gt;
&amp;nbsp; l - display the current line after the debugger&lt;br /&gt;
&amp;nbsp; c - continue&lt;br /&gt;
&amp;nbsp; You can also check the readme of the ruby-debug&lt;br /&gt;
&lt;br /&gt;
2. You can use puts,exit etc.&lt;br /&gt;
&lt;br /&gt;
3. You can use&amp;nbsp; logger.debug "The object is #{@object}" or&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp; RAILS_DEFAULT_LOGGER.debug @object&lt;br /&gt;
&lt;br /&gt;
4. In view, you can also use &amp;lt;%=debug @object %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. You can simultaneously check your log by running tail -f lod/development.log in the another terminal or you can also use tail -n log/development.log where n is any numeric number&lt;br /&gt;
&lt;br /&gt;
6. We can use Exception Notifier plugin in our production environment so that we gets an notification mail if any error occurs on production&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Call Rake task from migration</title><link>http://blogofchirag.blogspot.com/2011/01/call-rake-task-from-migration.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Mon, 24 Jan 2011 12:18:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-430507121753394634</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&amp;nbsp;You can call the rake task in migration by writing following&lt;br /&gt;
&lt;br /&gt;
Rake::Task[this_is_rake_task'].invoke&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Is the string has numeric value?</title><link>http://blogofchirag.blogspot.com/2011/01/is-string-has-numeric-value.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Mon, 24 Jan 2011 12:16:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-4142332095276331578</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;for check the string has numeric value or not then you can do it by below&lt;br /&gt;
s = "123cs"&lt;br /&gt;
&lt;br /&gt;
then call method as below&lt;br /&gt;
is_numeric?(s) &lt;br /&gt;
&lt;br /&gt;
and the method is as below&lt;br /&gt;
&amp;nbsp;def is_numeric?(s) &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; s.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true &lt;br /&gt;
&amp;nbsp; end&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Run your rails application with apache2 and mongrel_clusters</title><link>http://blogofchirag.blogspot.com/2011/01/run-your-rails-application-with-apache2.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Mon, 24 Jan 2011 11:25:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-8582075283778812050</guid><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Run your rails application with apache2 and mongrel_clusters&lt;br /&gt;
&lt;br /&gt;
Install Apache 2.2 and enable the needed modules (url rewriting, proxy, proxy_balancer e proxy_http)&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install apache2&lt;br /&gt;
&lt;br /&gt;
# enable your modules in apache&lt;br /&gt;
sudo a2enmod rewrite&lt;br /&gt;
sudo a2enmod proxy&lt;br /&gt;
sudo a2enmod proxy_balancer&lt;br /&gt;
sudo a2enmod proxy_http&lt;br /&gt;
sudo a2enmod proxy_connect&lt;br /&gt;
&lt;br /&gt;
# if you not enabled any of the modules then may be errors occured while you restart your apache after adding the below configration&lt;br /&gt;
# Error may be encoutered it yoou have not enabled module rewrite is "Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration"&lt;br /&gt;
&lt;br /&gt;
Install Mongrel, create a mongrel user, create the mongrel cluster&lt;br /&gt;
sudo gem install daemons gem_plugin mongrel mongrel_cluster --include-dependencies&lt;br /&gt;
&lt;br /&gt;
You can continue with the same linux user to mongrel if you want otherwise you can create new user by &lt;br /&gt;
sudo /usr/sbin/adduser mongrel&lt;br /&gt;
This line creates new user mongrel withg same mongrel group&lt;br /&gt;
Now need to create one mongrel_cluster.yml&lt;br /&gt;
sudo mongrel_rails cluster::configure -e production -p 3010 -N 2 -c /home/user/projects/myapp -a 127.0.0.1 --user mongrel --group mongrel&lt;br /&gt;
&lt;br /&gt;
here -e = your working environment&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -p = your port for run application&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -N = Number of instances of the application. here 2 instances for my application and port is 3010. so this application will work on 3010 and 3011 port&lt;br /&gt;
&amp;nbsp;--user = need to provide your linuxuser&lt;br /&gt;
--group = need to provide your linuxgroup&lt;br /&gt;
&lt;br /&gt;
this line will create /config/mongrel_cluster.yml file with following command&lt;br /&gt;
user: mongrel&lt;br /&gt;
cwd: /home/user/projects/myapp&lt;br /&gt;
log_file: log/mongrel.log&lt;br /&gt;
port: "3010"&lt;br /&gt;
environment: production&lt;br /&gt;
group: mongrel&lt;br /&gt;
address: 127.0.0.1&lt;br /&gt;
pid_file: tmp/pids/mongrel.pid&lt;br /&gt;
servers: 2&lt;br /&gt;
&lt;br /&gt;
now make sure that tmp and log folder has permission to the user/group which you have user in mongrel_cluster if not assign permission by &lt;br /&gt;
sudo chown -R mongrel:mongrel /path/to/app/tmp&lt;br /&gt;
&lt;br /&gt;
# Now start mongrel clusters&lt;br /&gt;
sudo mongrel_rails cluster::start&lt;br /&gt;
&lt;br /&gt;
Hopefully clusters is worked perfactly and you can get it run on multiple port 3010 and 3011&lt;br /&gt;
http://127.0.0.1:3010&lt;br /&gt;
http://127.0.0.1:3011&lt;br /&gt;
&lt;br /&gt;
Now need to set proxy balancer for this app&lt;br /&gt;
For this need to create one host for you app&lt;br /&gt;
Go to sudo nano /etc/hosts&lt;br /&gt;
&lt;br /&gt;
127.0.0.1 localhost&lt;br /&gt;
127.0.0.1 myapp&lt;br /&gt;
&lt;br /&gt;
Now need to configure Apache configuration file (sudo gedit /etc/apache2/sites-available/default).&lt;br /&gt;
&lt;br /&gt;
NameVirtualHost *:80&lt;br /&gt;
&lt;br /&gt;
#we need this as on Ubuntu/debian by default Proxy is not allowed&lt;br /&gt;
&amp;lt;Proxy *&amp;gt;&lt;br /&gt;
&amp;nbsp; Order allow,deny&lt;br /&gt;
&amp;nbsp; Allow from all&lt;br /&gt;
&amp;lt;/Proxy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Proxy balancer section (create one for each ruby app cluster)&lt;br /&gt;
&amp;nbsp; &amp;lt;Proxy balancer://myapp_cluster&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; BalancerMember http://myapp:3010&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; BalancerMember http://myapp:3011&lt;br /&gt;
&amp;nbsp; &amp;lt;/Proxy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Virtual host section (create one for each ruby app you need to publish)&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;ServerAdmin webmaster@localhost&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServerName myapp&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DocumentRoot /home/user/projects/myapp/public/&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Directory /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Options FollowSymLinks&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;AllowOverride None&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Directory /home/debian/chirag/mycalltime/public/&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Options Indexes FollowSymLinks MultiViews&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;AllowOverride All&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Order allow,deny&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;allow from all&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Directory "/usr/lib/cgi-bin"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;AllowOverride None&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Order allow,deny&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Allow from all&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;ErrorLog /var/log/apache2/error.log&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;# Possible values include: debug, info, notice, warn, error, crit,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;# alert, emerg.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;LogLevel warn&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;CustomLog /var/log/apache2/access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Alias /doc/ "/usr/share/doc/"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Directory "/usr/share/doc/"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Options Indexes MultiViews FollowSymLinks&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AllowOverride None&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order deny,allow&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Deny from all&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Allow from 127.0.0.0/255.0.0.0 ::1/128&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; #Rewrite stuff&lt;br /&gt;
&amp;nbsp; RewriteEngine On&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; # Check for maintenance file and redirect all requests&lt;br /&gt;
&amp;nbsp; RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f&lt;br /&gt;
&amp;nbsp; RewriteCond %{SCRIPT_FILENAME} !maintenance.html&lt;br /&gt;
&amp;nbsp; RewriteRule ^.*$ /system/maintenance.html [L]&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; # Rewrite index to check for static&lt;br /&gt;
&amp;nbsp; RewriteRule ^/$ /index.html [QSA] &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; # Rewrite to check for Rails cached page&lt;br /&gt;
&amp;nbsp; RewriteRule ^([^.]+)$ $1.html [QSA]&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; # Redirect all non-static requests to cluster&lt;br /&gt;
&amp;nbsp; RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f&lt;br /&gt;
&amp;nbsp; RewriteRule ^/(.*)$ balancer://myapp_cluster%{REQUEST_URI} [P,QSA,L]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After configure the default file need to restart apache&lt;br /&gt;
sudo /etc/init.d/apache2 restart&lt;br /&gt;
&lt;br /&gt;
Cheers.... &lt;br /&gt;
You get your app running on multiple instanses with proxy balancer&lt;br /&gt;
http://myapp&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>search gem from repository</title><link>http://blogofchirag.blogspot.com/2010/08/search-gem-from-repository.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Tue, 10 Aug 2010 17:29:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-8923283136399595657</guid><description>If you want to find a gem in the repository then you can do it by following way&lt;br /&gt;
&lt;br /&gt;
gem1.8 list -r | grep gem_name</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Unpacked gem authlogic-2.1.3 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.</title><link>http://blogofchirag.blogspot.com/2010/06/unpacked-gem-authlogic-213-in.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Wed, 30 Jun 2010 14:12:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-8529777546254506300</guid><description>You can solve this issue by following way&lt;br /&gt;
&lt;br /&gt;
&amp;gt;  cd vendor/gems/authlogic-2.1.3&lt;br /&gt;
&amp;gt;  gem specification authlogic &amp;gt; .specification&lt;br /&gt;
&lt;br /&gt;
cheers,</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Get Session Data Available in Models - Ruby on Rails</title><link>http://blogofchirag.blogspot.com/2010/06/get-session-data-available-in-models.html</link><author>noreply@blogger.com (Chirag Shah)</author><pubDate>Thu, 24 Jun 2010 12:41:00 +0530</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-2564021856242776522.post-4056455649595873269</guid><description>&lt;div style="color: #073763; font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: large;"&gt;Sometimes we really need session variables inside model. But as the rails framework defines (MVC) pattern.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;This pattern separates the context of the Web Application (Controller,View) from the Model. Model contains business logic of the web application. The Controller handles the interactions between the View and the Model.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;So you can not access sessions directly in your model. You can crack it by following way.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: #990000;"&gt;&lt;span style="font-size: large;"&gt;&lt;b&gt;Create one module&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: purple; font-weight: bold;"&gt;module&lt;/span&gt; &lt;span style="color: #38761d;"&gt;Utility&lt;/span&gt;
  &lt;span style="color: purple; font-weight: bold;"&gt;def&lt;/span&gt; current_user
    &lt;span style="color: #cc00ff; font-weight: bold;"&gt;Thread&lt;/span&gt;.&lt;span style="color: purple;"&gt;current&lt;/span&gt;&lt;span style="color: #006600; font-weight: bold;"&gt;[&lt;/span&gt;&lt;span style="color: #ff3333; font-weight: bold;"&gt;:user&lt;/span&gt;&lt;span style="color: #006600; font-weight: bold;"&gt;]&lt;/span&gt;
 &lt;span style="color: purple;"&gt; &lt;/span&gt;&lt;span style="color: purple; font-weight: bold;"&gt;end&lt;/span&gt;
&amp;nbsp;
  &lt;span style="color: purple; font-weight: bold;"&gt;def&lt;/span&gt; &lt;span style="color: blue; font-weight: bold;"&gt;self&lt;/span&gt;.&lt;span style="color: purple;"&gt;current_user=&lt;/span&gt;&lt;span style="color: #006600; font-weight: bold;"&gt;(&lt;/span&gt;user&lt;span style="color: #006600; font-weight: bold;"&gt;)&lt;/span&gt;
    &lt;span style="color: #cc00ff; font-weight: bold;"&gt;Thread&lt;/span&gt;.&lt;span style="color: purple;"&gt;current&lt;/span&gt;&lt;span style="color: #006600; font-weight: bold;"&gt;[&lt;/span&gt;&lt;span style="color: #ff3333; font-weight: bold;"&gt;:user&lt;/span&gt;&lt;span style="color: #006600; font-weight: bold;"&gt;]&lt;/span&gt; = user
  &lt;span style="color: purple; font-weight: bold;"&gt;end&lt;/span&gt;
&lt;span style="color: purple; font-weight: bold;"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: #9966cc; font-weight: bold;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="ruby" style="color: #990000; font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-weight: bold;"&gt;Add following in application controller&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: #9966cc; font-weight: bold;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: purple; font-weight: bold;"&gt;class&lt;/span&gt;&lt;span style="color: purple;"&gt; &lt;/span&gt;&lt;span style="color: #38761d;"&gt;ApplicationController&lt;/span&gt; &lt;span style="color: #006600; font-weight: bold;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #6666ff; font-weight: bold;"&gt;ActionController::Base&lt;/span&gt;
  &lt;span style="color: purple; font-weight: bold;"&gt;include&lt;/span&gt; &lt;span style="color: #bf9000;"&gt;Utility&lt;/span&gt;
&lt;span style="color: #996600;"&gt;&lt;/span&gt;  before_filter &lt;span style="color: #ff3333; font-weight: bold;"&gt;:set_user_session&lt;/span&gt;
&amp;nbsp;
 &lt;span style="color: purple;"&gt; &lt;/span&gt;&lt;b&gt;&lt;span style="background-color: white; color: purple;"&gt;protected&lt;/span&gt;&lt;/b&gt;
&lt;span style="color: green; font-style: italic;"&gt;&lt;/span&gt;  &lt;span style="color: purple; font-weight: bold;"&gt;def&lt;/span&gt; set_user_session
    &lt;b&gt;&lt;span style="color: magenta;"&gt;Utility&lt;/span&gt;&lt;/b&gt;.&lt;span style="color: purple;"&gt;current_user&lt;/span&gt; = session&lt;span style="color: #006600; font-weight: bold;"&gt;[&lt;/span&gt;&lt;span style="color: #ff3333; font-weight: bold;"&gt;:user&lt;/span&gt;&lt;span style="color: #006600; font-weight: bold;"&gt;]&lt;/span&gt;
 &lt;span style="color: purple;"&gt; &lt;/span&gt;&lt;span style="color: purple; font-weight: bold;"&gt;end&lt;/span&gt;
&lt;span style="color: purple; font-weight: bold;"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre class="ruby" style="color: purple; font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-weight: bold;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="ruby" style="color: #990000; font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-weight: bold;"&gt;And now get it in your model&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: #9966cc; font-weight: bold;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: purple; font-weight: bold;"&gt;class&lt;/span&gt; &lt;span style="color: #38761d;"&gt;Account&lt;/span&gt; &lt;span style="color: #006600; font-weight: bold;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: #6666ff; font-weight: bold;"&gt;ActiveRecord::Base&lt;/span&gt;
  &lt;span style="color: purple; font-weight: bold;"&gt;include&lt;/span&gt; &lt;span style="color: #bf9000;"&gt;Utility&lt;/span&gt;
&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: #9966cc; font-weight: bold;"&gt; &lt;span style="color: purple;"&gt; def&lt;/span&gt;&lt;/span&gt; before_create
    &lt;span style="color: purple;"&gt;unless&lt;/span&gt; allowed?&lt;span style="color: #006600; font-weight: bold;"&gt;(&lt;/span&gt;current_user)&lt;/span&gt;&lt;/pre&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;      return &lt;span style="color: purple;"&gt;false &lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;    &lt;span style="color: purple;"&gt;end&lt;/span&gt;
  &lt;span style="color: purple; font-weight: bold;"&gt;end&lt;/span&gt;
&lt;span style="color: purple; font-weight: bold;"&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="color: #9966cc; font-weight: bold;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="ruby" style="font-family: monospace;"&gt;&lt;span style="color: #9966cc; font-weight: bold;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item></channel></rss>