<?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: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-6055214834087664240</id><updated>2011-11-27T15:37:49.941-08:00</updated><category term='flash'/><category term='expected'/><category term='machinist'/><category term='templaterror'/><category term='full url'/><category term='method'/><category term='rpx'/><category term='array'/><category term='sessions'/><category term='test'/><category term='tail'/><category term='gvim syntax'/><category term='passenger'/><category term='nginx'/><category term='resources'/><category term='rails'/><category term='migrations'/><category term='email'/><category term='redirect_back_or_default'/><category term='vim'/><category term='redirect'/><category term='workling'/><category term='bdd'/><category term='got User'/><category term='generator'/><category term='sort'/><category term='force reload'/><category term='authentication'/><category term='toggle'/><category term='rateable'/><category term='hidden div'/><category term='sort_by'/><category term='cucumber'/><category term='callback'/><category term='markaby'/><category term='rest'/><category term='rails 2.0'/><category term='rspec'/><category term='bluehost'/><category term='actionmailer'/><category term='mongrel'/><category term='foreign keys'/><category term='file upload'/><category term='habtm'/><category term='highlighting'/><category term='view helpers'/><category term='toturoal'/><category term='ubuntu'/><category term='uninitialized constant'/><category term='plugins'/><category term='error'/><category term='subversion'/><category term='svn'/><category term='ruby'/><category term='url'/><category term='attachment_fu'/><category term='reserved words'/><category term='introduction'/><category term='javascript'/><category term='gutsy gubbon'/><category term='spec'/><category term='trace'/><category term='file download'/><category term='monit'/><category term='postfix'/><category term='currency'/><category term='hostingrails'/><category term='file_column'/><category term='check_box'/><category term='silverrack'/><category term='define'/><category term='expire sessions'/><category term='plugin'/><category term='sham'/><category term='helper'/><category term='hosting providers'/><category term='rpx_now'/><category term='single sign on'/><category term='before_create'/><category term='hardy heron'/><category term='expected User'/><category term='form.serialize'/><category term='scripts'/><category term='rake'/><category term='acts_as_rateable'/><category term='deploy'/><category term='acl system'/><category term='milliseconds'/><category term='ajax'/><category term='number'/><category term='tutorial'/><category term='aclsystem'/><category term='files'/><category term='scriptaculous'/><category term='star'/><category term='tip'/><category term='time'/><category term='enumerable'/><category term='blocks in views'/><category term='tests'/><category term='gvim'/><category term='--trace'/><category term='upload'/><category term='log'/><category term='server'/><category term='id'/><category term='command line'/><category term='password'/><title type='text'>Rails Hacks and Other Stuff</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>68</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-314443032646478974</id><published>2010-04-15T00:11:00.000-07:00</published><updated>2010-04-15T00:26:00.311-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file download'/><title type='text'>Downloading files</title><content type='html'>Wow it's been a year since I've last posted!&lt;br /&gt;&lt;br /&gt;I'm currently checking out dragonfly, the new kid on the block file processor. It's mean to replace stuff like paperclip and attachment_fu. To make things simple, especially if you don't have a lot of files, when migrating from either of those to dragonfly it may be simpler to just download the file and upload it again via dragonfly. This way you don't have to study the internals of each file management plugin.&lt;br /&gt;&lt;br /&gt;So, here's how to download a file.&lt;br /&gt;&lt;br /&gt;require 'net/http'&lt;br /&gt;&lt;br /&gt;url = URI.parse "http://url.to/file.name"&lt;br /&gt;Net::HTTP.start url.host do |http|&lt;br /&gt;  response = http.get url.path&lt;br /&gt;  MyModel.create! :file =&gt; response.body &lt;br /&gt;  # Here you tell your model to create the file. &lt;br /&gt;  # This is what the create action in the controller calls &lt;br /&gt;  # but instead of params[:file], you have response.body&lt;br /&gt;end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-314443032646478974?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/314443032646478974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=314443032646478974' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/314443032646478974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/314443032646478974'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2010/04/downloading-files.html' title='Downloading files'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-5908129120182620123</id><published>2009-04-17T09:02:00.000-07:00</published><updated>2009-04-17T09:04:02.108-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><title type='text'>Vim Setup</title><content type='html'>I've posted many a setup in vim before, but I've decided to put it &lt;a href="http://github.com/ramontayag/vim_setup/tree/master"&gt;on github&lt;/a&gt; for easier management.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-5908129120182620123?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/5908129120182620123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=5908129120182620123' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5908129120182620123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5908129120182620123'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/04/vim-setup.html' title='Vim Setup'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-7459636715761983311</id><published>2009-04-01T05:06:00.000-07:00</published><updated>2009-04-01T05:11:17.766-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='acts_as_rateable'/><category scheme='http://www.blogger.com/atom/ns#' term='star'/><category scheme='http://www.blogger.com/atom/ns#' term='rateable'/><title type='text'>Stars and acts_as_rateable</title><content type='html'>I recently wanted to implement a star system in Rails. I looked at &lt;a href="http://github.com/azabaj/acts_as_rateable/tree/master"&gt;this rateable plugin&lt;/a&gt; and followed &lt;a href="http://swik.net/Rails/Dave+Naffis+-+Rails,+Ruby,+Randomness/Ruby+on+Rails,+Ajax+&amp;+CSS+Star+Rating+System/kqn0"&gt;this tutorial to create the stars&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;It wasn't as cut and dried as I had hoped, so &lt;a href="http://pastie.org/433706"&gt;here is the code I used&lt;/a&gt;. It's pretty complete. Disclaimer: I used haml and sass and if you don't, you should still be able to understand the code. In case you don't use sass, here's &lt;a href="http://pastie.org/433713"&gt;the generated CSS that you get from the sass file&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-7459636715761983311?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/7459636715761983311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=7459636715761983311' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7459636715761983311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7459636715761983311'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/04/stars-and-actsasrateable.html' title='Stars and acts_as_rateable'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-2763527721296098902</id><published>2009-03-27T22:13:00.000-07:00</published><updated>2009-03-27T22:22:52.042-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='callback'/><category scheme='http://www.blogger.com/atom/ns#' term='before_create'/><title type='text'>before_create should return the right boolean!</title><content type='html'>This is a small thing, but I wasted an hour or so figuring this thing out. I had an a before_create where I set a boolean variable to false and then my tests started to fail? Why? Because before_create will stop the creation of the record if it returns false!&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class A &lt;&lt; AR::Base&lt;br /&gt; before_create :set_enabled&lt;br /&gt;&lt;br /&gt; def set_enabled&lt;br /&gt;   self.enabled = false&lt;br /&gt;   true # so that it doesn't fail&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-2763527721296098902?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/2763527721296098902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=2763527721296098902' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2763527721296098902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2763527721296098902'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/03/beforecreate-should-return-right.html' title='before_create should return the right boolean!'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-5185349313846560525</id><published>2009-03-20T22:46:00.000-07:00</published><updated>2009-03-20T23:06:19.602-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='monit'/><category scheme='http://www.blogger.com/atom/ns#' term='passenger'/><category scheme='http://www.blogger.com/atom/ns#' term='postfix'/><title type='text'>Passenger, Monit, Postfix</title><content type='html'>Setting up Passenger was quite easy, coming from the world of Mongrel. For the most part I followed &lt;a href="http://hackd.thrivesmarthq.com/how-to-setup-a-linux-server-for-ruby-on-rails-with-github-and-phusion-passenger"&gt;this&lt;/a&gt;. It's pretty comprehensive, but I'll just add some stuff that I had to do on my own.&lt;br /&gt;&lt;br /&gt;This is far from a comprehensive list, and if you just follow this things won't work.  This also assumes you have _some_ knowledge of how Postfix, Monit, Linux works.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;Postfix&lt;/span&gt;&lt;br /&gt;I accept and read mail somewhere else (not on the VPS that sends mail). For example, I may use Google to accept mail on the Internet, however, I don't connect my server to Google to send mail.  Because of this, when postfix on my server tried to send mail to mydomain.com, it always something like "there is no user &lt;insert&gt; on this server". So I opened up /etc/postfix/main.cf and make sure that mydestination doesn't contain your domain name. mydestination tells postfix what resides on your local machine.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;mydestination = localhost.localdomain, localhost&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Also, to use it, my Rails app's setting were like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;ActionMailer::Base.delivery_method = :smtp&lt;br /&gt;ActionMailer::Base.smtp_settings = {&lt;br /&gt;  :address =&gt; "localhost",&lt;br /&gt;  :port =&gt; 25,&lt;br /&gt;  :domain =&gt; "www.theinksquad.com"&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;SilverRack and Sources&lt;/span&gt;&lt;br /&gt;Installing the clean 8.04 on SilverRack, /etc/apt/sources.list is virtually empty. You need to add:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span id="pj4h1"  style="color:#0b5394;"&gt;&lt;span id="esyj" style="color: rgb(0, 0, 0);"&gt;&lt;span id="bb-o0" style="color: rgb(11, 83, 148);"&gt;deb http://ubuntu.media.mit.edu/ubuntu/ hardy main restricted universe multiverse&lt;/span&gt;&lt;br /&gt;&lt;span id="bb-o2" style="color: rgb(11, 83, 148);"&gt;deb-src http://ubuntu.media.mit.edu/ubuntu/ hardy restricted main multiverse universe&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span id="bb-o5" style="color: rgb(11, 83, 148);"&gt;deb http://ubuntu.media.mit.edu/ubuntu/ hardy-updates main restricted universe multiverse&lt;/span&gt;&lt;br /&gt;&lt;span id="bb-o7" style="color: rgb(11, 83, 148);"&gt;deb-src http://ubuntu.media.mit.edu/ubuntu/ hardy-updates restricted main multiverse universe&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span id="bb-o10" style="color: rgb(11, 83, 148);"&gt;deb http://security.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse&lt;/span&gt;&lt;br /&gt;&lt;span id="bb-o12" style="color: rgb(11, 83, 148);"&gt;deb-src http://security.ubuntu.com/ubuntu/ hardy-security restricted main multiverse universe&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then "sudo apt-get update" after&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;Monit&lt;/span&gt;&lt;br /&gt;The tutorial above didn't have any tutorial for Monit or God.rb. Install the dependencies first:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span id="zids0"  style="color:#0b5394;"&gt;sudo apt-get install flex byacc bison -y&lt;/span&gt;&lt;br /&gt;&lt;span id="pj4h1"  style="color:#0b5394;"&gt;&lt;span id="esyj" style="color: rgb(0, 0, 0);"&gt;&lt;span id="bb-o12" style="color: rgb(11, 83, 148);"&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then monit (Make sure this is the latest and greatest version):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);" id="r_zk0" &gt;wget &lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;http://mmonit.com/monit/dist/beta/monit-5.0_beta7.tar.gz&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);" id="r_zk0" &gt;tar -xzvf &lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;monit-5.0_beta7.tar.gz&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);" id="r_zk0" &gt; &amp;amp;&amp;amp; cd &lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;monit-5.0_beta7&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);" id="r_zk0" &gt;/ &amp;amp;&amp;amp; sudo ./configure &amp;amp;&amp;amp; sudo make &amp;amp;&amp;amp; sudo make install &amp;amp;&amp;amp; cd ../&lt;/span&gt;&lt;br /&gt;&lt;span id="zlzp87"  style="color:#0b5394;"&gt;&lt;/span&gt;&lt;span id="rxfr1"  style="color:#0b5394;"&gt;sudo mkdir /etc/monit.d&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then make the monit file for Apache.  This file basically tells monit what to watch out for, and how.&lt;br /&gt;&lt;br /&gt;Sample /etc/monit.d/apache.monitrc&lt;br /&gt;&lt;span id="or6q"  style="color:#000000;"&gt;&lt;pre&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;check process apache with pidfile /var/run/apache2.pid&lt;br /&gt;  start program = "/etc/init.d/apache2 start"&lt;br /&gt;  stop program = "/etc/init.d/apache2 stop"&lt;br /&gt;  if cpu &gt; 60% for 2 cycles then alert&lt;br /&gt;  if cpu &gt; 80% for 5 cycles then restart&lt;br /&gt;  if totalmem &gt; 200.0 MB for 5 cycles then restart&lt;br /&gt;  if children &gt; 250 then restart&lt;br /&gt;  if loadavg(5min) greater than 20 for 8 cycles then alert&lt;br /&gt;  group yourappnamehere&lt;/span&gt;&lt;br /&gt;&lt;span id="or6q"  style="color:#000000;"&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Since I use workling, I also made a seperate file for it:&lt;br /&gt;&lt;span id="or6q"  style="color:#000000;"&gt;&lt;span id="or6q0"  style="color:#0b5394;"&gt;server$ sudo vi /etc/&lt;span style="color: rgb(11, 83, 148);" id="or6q1" &gt;monit.d/workling.monitrc&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;and paste (do a "which ruby" to find out where ruby is and replace the /usr/bin/ruby if needed)&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;check process workling with pidfile /var/www/&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;yourappname&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;/shared/log/workling.pid&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;  start program = "/bin/bash -c 'HOME=/var/www/&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;yourappname&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;/current RAILS_ENV=production /usr/bin/ruby /var/www/&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;yourappname&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;/current/script/workling_client start'"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;  stop program = "/bin/bash -c '/usr/bin/ruby /var/www/&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;yourappname&lt;/span&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;/current/script/workling_client stop'"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;  if totalmem is greater than 180.0 mb for 5 cycles then restart&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;  if cpu is greater than 90% for 5 cycles then restart&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;  if 20 restarts within 20 cycles then timeout&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;  group yourappname&lt;/span&gt;&lt;br /&gt;&lt;span id="or6q"  style="color:#000000;"&gt;&lt;/pre&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then reload monit via "sudo monit reload".&lt;br /&gt;&lt;br /&gt;Now monit needs to be told to start automatically when we startup and when/if it crashes, we'll use upstart (this is for Ubuntu only?)&lt;span id="zlzp97"  style="color:#000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;&lt;span style="font-family: Georgia,serif;"&gt;&lt;pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; &lt;span id="zlzp97"  style="color:#000000;"&gt;&lt;span id="cx6d0"  style="color:#0b5394;"&gt;server$ sudo vi /etc/event.d/service_monit&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;&lt;span style="font-family: Georgia,serif;"&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; &lt;br /&gt;&lt;span id="zlzp97"  style="color:#000000;"&gt;and paste (do a "which monit" to find out where  monit is and replace the /usr/local/bin/monit if needed)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;&lt;span style="font-family: Georgia,serif;"&gt;&lt;pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;# This is an event.d (upstart) script to keep monit running&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;# To install disable the old way of doing things:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;# /etc/init.d/monit stop &amp;amp;&amp;amp; update-rc.d -f monit remove&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;# then put this script here: /etc/event.d/monit&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;# You can manually start and stop monit like this:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;# &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;# start monit&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;# stop monit&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;#&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;# Michael Hale (http://halethegeek.com)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;start on startup&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;start on runlevel 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;start on runlevel 3&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;start on runlevel 4&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;start on runlevel 5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;stop on runlevel 0&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;stop on runlevel 6&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;exec /usr/local/bin/monit -Ic /etc/monit/monitrc&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;respawn&lt;span style="font-family: Georgia,serif;"&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-5185349313846560525?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/5185349313846560525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=5185349313846560525' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5185349313846560525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5185349313846560525'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/03/passenger-monit-postfix.html' title='Passenger, Monit, Postfix'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-4962928373987872450</id><published>2009-03-18T00:49:00.000-07:00</published><updated>2009-03-18T01:01:23.007-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='passenger'/><category scheme='http://www.blogger.com/atom/ns#' term='workling'/><title type='text'>Moving To Passenger, Workling</title><content type='html'>I've used backgroundrb for a while now. Coupled with mongrels, monit, it wasn't a pleasant experience.  Oh, I forgot to mention that I was learning Linux at the time (still am actually), so it was very difficult for me.&lt;br /&gt;&lt;br /&gt;Lately, I've been comtemplating moving my production environment to Passenger, Apache, Workling and God.  The next few posts will talk about my experience and what I did. :)&lt;br /&gt;&lt;br /&gt;For now, let me just say that this &lt;a href="http://hackd.thrivesmarthq.com/how-to-setup-a-linux-server-for-ruby-on-rails-with-github-and-phusion-passenger"&gt;help page&lt;/a&gt; played a big part in speeding up my staging.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-4962928373987872450?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/4962928373987872450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=4962928373987872450' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4962928373987872450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4962928373987872450'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/03/moving-to-workling.html' title='Moving To Passenger, Workling'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-1017370000805698474</id><published>2009-03-03T23:35:00.000-08:00</published><updated>2009-03-18T01:04:49.218-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='expire sessions'/><category scheme='http://www.blogger.com/atom/ns#' term='sessions'/><title type='text'>Cleaning Up Your ActiveRecord Sessions</title><content type='html'>I was looking for a way to do this and found a good resource to find out how (without coding it yourself!)&lt;br /&gt;&lt;br /&gt;http://www.quarkruby.com/2007/10/21/sessions-and-cookies-in-ruby-on-rails#sexpire refers to a plugin called limited session but the link is no longer valid.  Check out http://iprog.com/project/limited_sessions&lt;br /&gt;&lt;br /&gt;Update: this breaks in Rails 2.3, I think it's because of the lazy loading. I've never learned much about sessions, so for now I'll move back to file stored.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-1017370000805698474?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/1017370000805698474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=1017370000805698474' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1017370000805698474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1017370000805698474'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/03/cleaning-up-your-activerecord-sessions.html' title='Cleaning Up Your ActiveRecord Sessions'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-2257641242496114344</id><published>2009-02-17T17:57:00.000-08:00</published><updated>2009-02-17T18:04:03.921-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='view helpers'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>View helpers in flash</title><content type='html'>The other day I wanted a nice checkout link in my flash when users added a product to their cart (apart from the checkout in cart area).  I soon realized (or remembered) that you don't have access to view helpers in the controller, where you usually assign flash messages.&lt;br /&gt;&lt;br /&gt;I spent about 2 hours researching on how to do this but got no answer.  People resorted to fancy stuff just to put links in their flash messages.  I thought the answer was in the render method.  I first tried to use it but it didn't work because you can't call render/redirect_to twice in the same action:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;flash[:notice] = render :partial =&gt; "some/partial"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So I looked at the source and tried to figure out what it was in render that read the file and spat out the text.  10 minutes later, I got this to work:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;flash[:notice] = @template.render(:partial =&gt; "some/partial")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So now I can use link_to and other nice view helpers in that partial and it will all render nicely in the flash message. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-2257641242496114344?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/2257641242496114344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=2257641242496114344' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2257641242496114344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2257641242496114344'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/02/view-helpers-in-flash.html' title='View helpers in flash'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-7657004906022172064</id><published>2009-02-12T21:59:00.000-08:00</published><updated>2009-02-12T23:00:19.043-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rpx'/><category scheme='http://www.blogger.com/atom/ns#' term='single sign on'/><title type='text'>Smart Activation With Single Sign On</title><content type='html'>This post is related to another post of mine about &lt;a href="http://railshacks.blogspot.com/2009/02/rpx-now-single-sign-on.html"&gt;getting the rpx single sign on to work&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Scenario:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;You are using single sign on but require the user to have emails (Facebook does not return email) or require other fields (eg. accept terms of use).&lt;/li&gt;&lt;li&gt;You allow users to specify another email besides the one that is returned by the single sign on service (SSOS)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If the user changes that email, you want them to validate it (you send an email to them with a link to activate their account), but if they don't change it (meaning they use the same email that is returned by the SSOS), then the account will be automatically activated&lt;/li&gt;&lt;/ul&gt;For some reason, I did this the hard way at the beginning.  I won't expound on how but what I tried to do in 2 days (but failed) actually took 30 minutes doing it the right way (and worked).&lt;br /&gt;&lt;br /&gt;Requisites&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Make sure you got single sign on working (you're able to read responses and stuff)&lt;/li&gt;&lt;/ol&gt;If you look at &lt;a href="http://pastie.org/388014"&gt;my code&lt;/a&gt; and read it a few times you'll understand what I do.  From the RPX Controller, you render the login form so they have a chance to change stuff.  If they miss out on anything the errors will render.  If they submit it, then the form will be submitted to users/create and will render itself if they are still missing stuff.  The hidden_field of email_was just stays there, dormant, waiting to be compared later on.&lt;br /&gt;&lt;br /&gt;When the user finally has all their stuff filled up and submits the form, if they're on single sign on, then the user will be activated based on the comparison between the email_was and the current email they're trying to save.  If they're different, then they're not activated and the user observer sends out the activation mail.  If they are the same email, then the account is activated and they have to do one less step. :)&lt;br /&gt;&lt;br /&gt;If you have any comments or suggestions please let me know.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-7657004906022172064?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/7657004906022172064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=7657004906022172064' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7657004906022172064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7657004906022172064'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/02/smart-activation-with-single-sign-on.html' title='Smart Activation With Single Sign On'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-2604443041574993875</id><published>2009-02-08T00:52:00.000-08:00</published><updated>2009-02-08T01:13:46.491-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blocks in views'/><title type='text'>Blocks in View</title><content type='html'>I had a bunch of "if logged_in? &amp;amp;&amp;amp; current_user.admin?" in my views, which made it very ugly.  I saw an &lt;a href="http://railscasts.com/episodes/40"&gt;old video&lt;/a&gt; (it is also covered &lt;a href="http://railscasts.com/episodes/140-rails-2-2-extras"&gt;again&lt;/a&gt;) from &lt;a href="http://railscasts.com/"&gt;Railscasts&lt;/a&gt; and knew this would be my answer.&lt;br /&gt;&lt;br /&gt;However, I wanted more customization though.  What if I didn't want to wrap my admin_area in a div? What if I wanted to add conditions on the fly and not make a zillion [enter_some_name]_area methods?&lt;br /&gt;&lt;br /&gt;This would be particularly useful if, for example, I only want the "delete" option of an object to appear to admins and if the object if destroyable.&lt;br /&gt;&lt;br /&gt;In haml:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;- admin_area(:conditions =&gt; @object.destroyable?) do&lt;br /&gt; = link_to "Destroy", ...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Take a look at my &lt;a href="http://pastie.org/383089"&gt;helper method&lt;/a&gt; to see what I did. I'd appreciate any comments!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-2604443041574993875?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/2604443041574993875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=2604443041574993875' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2604443041574993875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2604443041574993875'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/02/blocks-in-view.html' title='Blocks in View'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-176715303594253402</id><published>2009-02-07T21:38:00.000-08:00</published><updated>2009-02-07T21:49:58.444-08:00</updated><title type='text'>Form Builder</title><content type='html'>I don't know why I never know about Form Builder!  I was making my own form helpers but in the completely stupid way - in the helper files, which made it clunky.  Check out these &lt;a href="http://tomek.codequest.eu/2008/12/28/how-to-write-a-custom-form-builder-in-rails/"&gt;two&lt;/a&gt; &lt;a href="http://onrails.org/articles/2008/06/13/advanced-rails-studio-custom-form-builder"&gt;posts&lt;/a&gt; that helped me out a lot.  Although it can seem complicated because of all the (what I think is) meta programming, I suggest you just dive in and explore.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-176715303594253402?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/176715303594253402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=176715303594253402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/176715303594253402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/176715303594253402'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/02/form-builder.html' title='Form Builder'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-5297769801350008936</id><published>2009-02-06T04:07:00.000-08:00</published><updated>2009-02-07T00:30:25.020-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rpx'/><category scheme='http://www.blogger.com/atom/ns#' term='rpx_now'/><title type='text'>RPX Now: Single Sign-on</title><content type='html'>As I write this, I'm trying to install the single sign-on capability that &lt;a href="http://rpxnow.com/"&gt;RPX Now&lt;/a&gt; gives you on my Rails app.  I've tried OpenID before (using open_id_authentication plugin and ruby-openid gem) and it was mightly complicated, plus you couldn't only use other 3rd party accounts.&lt;br /&gt;&lt;br /&gt;RPX Now claims to be super easy and so far, with &lt;a href="http://github.com/grosser/rpx_now/tree/master"&gt;grosser's rpx_now gem&lt;/a&gt;, it almost seems too easy -- except there are no tutorials that I can find on Google.  There are examples in gem's github site but they don't explain much.&lt;br /&gt;&lt;br /&gt;This is my attempt at writing one.&lt;br /&gt;&lt;br /&gt;First, install the gem (instructions in &lt;a href="http://github.com/grosser/rpx_now/tree/master"&gt;the github site&lt;/a&gt;).  If you want to put it in your environment.rb file, it should look like this (remove or replace the version number with an updated one):&lt;br /&gt;&lt;pre&gt;config.gem "grosser-rpx_now", :lib =&gt; "rpx_now", :version =&gt; "0.3", :source =&gt; "http://gems.github.com"&lt;br /&gt;&lt;/pre&gt;Then &lt;a href="http://pastie.org/382369"&gt;create an RpxController&lt;/a&gt; and add code similar to &lt;a href="http://pastie.org/382369"&gt;this&lt;/a&gt; to your user model.  Of course, you don't have to process the data yourself, but I wanted to (thus my rpx_controller is a bit longer, and I had to read the response in the User model) so that if the rpx profile is missing anything, it will render a something like my normal login page that basically has a form_for(@user ...) where they can fill up the missing data.&lt;br /&gt;&lt;br /&gt;Check out &lt;a href="http://pastie.org/382356"&gt;actual responses&lt;/a&gt; (I just removed any personal data).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-5297769801350008936?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/5297769801350008936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=5297769801350008936' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5297769801350008936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5297769801350008936'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/02/rpx-now-single-sign-on.html' title='RPX Now: Single Sign-on'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-5443911683719778930</id><published>2009-02-06T04:04:00.000-08:00</published><updated>2009-02-06T04:07:18.702-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='server'/><category scheme='http://www.blogger.com/atom/ns#' term='hosting providers'/><title type='text'>Hosting Services</title><content type='html'>I don't run websites with thousands of users at a time, however, I thought I'd still announce what I use for my hosting services.&lt;br /&gt;&lt;br /&gt;VPS: &lt;a href="http://silverrack.com"&gt;SilverRack&lt;/a&gt;&lt;br /&gt;Good price, quick service.  They don't spend time fussing over you though, but that's expected in a VPS.&lt;br /&gt;&lt;br /&gt;Shared: &lt;a href="http://www.hostingrails.com/home/3168727562"&gt;HostingRails&lt;/a&gt; (disclaimer: affiliate link)&lt;br /&gt;I've tried BlueHost, Dreamhost, but I've found HostingRails to be the easiest to deal with.  Their support replies lightning fast, and don't diss you even if your problems are your fault!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-5443911683719778930?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/5443911683719778930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=5443911683719778930' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5443911683719778930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5443911683719778930'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/02/hosting-services.html' title='Hosting Services'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-6900635457519749914</id><published>2009-02-03T23:32:00.000-08:00</published><updated>2009-02-03T23:47:54.262-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='uninitialized constant'/><category scheme='http://www.blogger.com/atom/ns#' term='trace'/><category scheme='http://www.blogger.com/atom/ns#' term='sham'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='cucumber'/><category scheme='http://www.blogger.com/atom/ns#' term='error'/><category scheme='http://www.blogger.com/atom/ns#' term='--trace'/><category scheme='http://www.blogger.com/atom/ns#' term='rake'/><category scheme='http://www.blogger.com/atom/ns#' term='machinist'/><title type='text'>Using --trace; cucumber &amp; machinist order of loading files</title><content type='html'>I followed &lt;a href="http://itsignals.cascadia.com.au/?p=30"&gt;this tutorial&lt;/a&gt; to easily use &lt;a href="http://wiki.github.com/aslakhellesoy/cucumber/ruby-on-rails"&gt;Cucumber&lt;/a&gt; with a fixture replacement plugin called &lt;a href="http://github.com/notahat/machinist/tree/master"&gt;Machinist&lt;/a&gt;.  It worked great on my desktop, but when I moved to my laptop, running rake features didn't work - an "uninitialized constant Sham" error popped up and I spent a day figuring it out.&lt;br /&gt;&lt;br /&gt;Although the context of this problem is Cucumber and Machinist (which includes Sham), this is a post that talks about using --trace when you run into problems similar to this.&lt;br /&gt;&lt;br /&gt;IF YOU'RE FAMILIAR WITH CUCUMBER &amp;amp;  MACHINIST...&lt;br /&gt;The problem occured partially because I put my blueprints.rb file where env.rb is.  I believe cucumber loads everything there in alphabetical order (doesn't explain why my desktop loaded things differently).  The problem is that blueprints.rb tries to call "Sham" which is something that is loaded by Machinist, which in turn is loaded during or after env.rb, not before.&lt;br /&gt;&lt;br /&gt;IF YOU'RE NOT FAMILIAR NEITHER CUCUMBER NOR MACHINIST...&lt;br /&gt;The problem occured because of the order files were loaded. I do not know why files were loaded differently in my desktop vs the laptop, but what the heck -- I found the error by using --trace and actually read the big &lt;a href="http://pastie.org/379188"&gt;bad ugly code&lt;/a&gt; that rake conveniently hides from us.&lt;br /&gt;&lt;br /&gt;http://pastie.org/379188&lt;br /&gt;&lt;br /&gt;So the lesson is: actually read what --trace spits out! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6900635457519749914?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6900635457519749914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6900635457519749914' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6900635457519749914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6900635457519749914'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/02/using-trace-cucumber-machinist-order-of.html' title='Using --trace; cucumber &amp; machinist order of loading files'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-7798061457133180168</id><published>2009-01-23T06:23:00.001-08:00</published><updated>2009-01-23T06:27:38.316-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='test'/><category scheme='http://www.blogger.com/atom/ns#' term='tests'/><category scheme='http://www.blogger.com/atom/ns#' term='actionmailer'/><title type='text'>Speeding up emailing in tests</title><content type='html'>I lived with the fact that my test ground to a halt when my tests ran code that had to send emails.  It finally got so bad I started asking around about it.&lt;br /&gt;&lt;br /&gt;I knew about a method to &lt;a href="http://kpumuk.info/ruby-on-rails/testing-mailers-with-rspec/"&gt;test ActionMailer&lt;/a&gt; and not send out emails... and I thought: why not apply these to ActionMailer when it's in the test environment?  I ran my tests with rspec.  Check out &lt;a href="http://pastie.org/368698"&gt;the pastie&lt;/a&gt; to see the code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-7798061457133180168?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/7798061457133180168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=7798061457133180168' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7798061457133180168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7798061457133180168'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2009/01/speeding-up-emailing-in-tests.html' title='Speeding up emailing in tests'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-6167052080147475191</id><published>2008-10-21T00:01:00.000-07:00</published><updated>2008-10-21T00:04:42.696-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='spec'/><category scheme='http://www.blogger.com/atom/ns#' term='attachment_fu'/><category scheme='http://www.blogger.com/atom/ns#' term='test'/><title type='text'>RSpec, attachment_fu</title><content type='html'>I've been looking for a solution to force RSpec tests to override the attachment_fu storage setting.  Since I use s3, it was very inefficient when I'd run my tests because the assets would be saved in s3.  Not only does it cost money, but it was very slow.&lt;br /&gt;&lt;br /&gt;After spamming #rubyonrails I finally got an answer from _martinS_.  He told me to do something like this: http://pastie.org/296895 - and it worked!  I hope this helps you guys.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6167052080147475191?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6167052080147475191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6167052080147475191' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6167052080147475191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6167052080147475191'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/10/rspec-attachmentfu.html' title='RSpec, attachment_fu'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-1535677492622567191</id><published>2008-09-28T09:56:00.000-07:00</published><updated>2008-09-28T10:02:27.010-07:00</updated><title type='text'>Compiling Sphinx in Ubuntu</title><content type='html'>I had just watched Ryan Bates' &lt;a href="http://railscasts.com/episodes/120"&gt;screencast on Sphinx&lt;/a&gt; and I wanted to install it on Ubuntu.  Took me a while to find out how, so here are my instructions.  I'm on Ubuntu 8.04&lt;br /&gt;&lt;br /&gt;1. &lt;a href="http://www.sphinxsearch.com/downloads.html"&gt;Download the latest realease&lt;/a&gt;. It's 0.9.8 as of writing.&lt;br /&gt;2. Install it with &lt;a href="file:///home/ramon/sphinx-0.9.8/doc/sphinx.html#supported-system"&gt;their instructions&lt;/a&gt;.  I ran into a problem though - I have MySQL already but not the files Sphinx needs to install.  If you ran into this problem, continue:&lt;br /&gt;3. In console, type:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;mysql_config --cflags&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That will tell you the package you need to install.&lt;br /&gt;4. Mine was libmysqlclient15-dev:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;sudo apt-get install libmysqlclient15-dev&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;5. Try installing Sphinx again, it should work this time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-1535677492622567191?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/1535677492622567191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=1535677492622567191' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1535677492622567191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1535677492622567191'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/09/compiling-sphinx-in-ubuntu.html' title='Compiling Sphinx in Ubuntu'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-1598526149306921034</id><published>2008-09-09T08:40:00.000-07:00</published><updated>2008-09-09T08:41:56.019-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='attachment_fu'/><title type='text'>attachment_fu, Rails 2.1 and before_thumbnail_saved</title><content type='html'>I was working on before_thumbnail_saved callback in Rails 2.1 and it seems it has changed!  It didn't work with me anymore.  At least my old code didn't.&lt;br /&gt;&lt;br /&gt;Apparently, you only pass the thumbnail into the loop.&lt;br /&gt;&lt;br /&gt;Read this &lt;a href="http://www.nullislove.com/2008/07/29/attachment_fu-tip/"&gt;blog post&lt;/a&gt; for details.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-1598526149306921034?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/1598526149306921034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=1598526149306921034' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1598526149306921034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1598526149306921034'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/09/attachmentfu-rails-21-and.html' title='attachment_fu, Rails 2.1 and before_thumbnail_saved'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-6551868615559239739</id><published>2008-09-05T07:23:00.000-07:00</published><updated>2008-09-05T07:27:56.506-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='attachment_fu'/><category scheme='http://www.blogger.com/atom/ns#' term='rake'/><title type='text'>Rake: Update or create images generated by attachment_fu</title><content type='html'>Did you upload a bunch of images and find out that the new layout needs a new size of the photos, and you didn't specify this in the has_attachment line of your model?&lt;br /&gt;&lt;br /&gt;This happened to me, and I wanted an easy to way update all images in the database.  I didn't test this with millions of records or anything, but if you want to fix this up please leave a comment.&lt;br /&gt;&lt;br /&gt;Notes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;To use, simply edit has_attachment line with the new thumbnail sizes you want.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;IdeaImage is the model that I want to update&lt;/li&gt;&lt;li&gt;parentless is a named_scope that gets only the IdeaImages whose parent_id's are null.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;&lt;br /&gt;  namespace :images do&lt;br /&gt;    desc "Updates all the thumbnails of idea_images based on the thumbnails hash in the model"&lt;br /&gt;    task(:update_idea_images =&gt; :environment) do&lt;br /&gt;      IdeaImage.parentless.each do |i|&lt;br /&gt;        #destroy the thumbnails first&lt;br /&gt;        i.thumbnails.each { |thumbnail| thumbnail.destroy } if i.thumbnailable?&lt;br /&gt;        #then recreate the thumbnails&lt;br /&gt;        i.attachment_options[:thumbnails].each { |suffix, size| i.create_or_update_thumbnail(i.create_temp_file, suffix, *size) }&lt;br /&gt;      end&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6551868615559239739?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6551868615559239739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6551868615559239739' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6551868615559239739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6551868615559239739'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/09/rake-update-or-create-images-generated.html' title='Rake: Update or create images generated by attachment_fu'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-7102958404368244256</id><published>2008-08-01T00:46:00.000-07:00</published><updated>2008-10-01T20:26:45.998-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardy heron'/><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='gvim'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Installing the latest gVim and Vim in Ubuntu Hardy Heron</title><content type='html'>I recently got a new computer and reinstalled Ubuntu and found out that my old post on how to install the latest gVim in Hardy Heron didn't work anymore.  This is what I did to install the latest one.  Thanks &lt;a href="http://launchpadlibrarian.net/15444002/vim-build.txt"&gt;godlygeek&lt;/a&gt;!&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;pre&gt;sudo apt-get build-dep vim&lt;br /&gt;sudo apt-get install build-essential devscripts fakeroot dpkg-dev&lt;br /&gt;apt-get source vim&lt;br /&gt;cd vim-7.1&lt;br /&gt;(cd upstream/patches; python get_patches.py)&lt;br /&gt;dch -v 1:7.1-138+1ubuntu4~$(whoami)1 "Updated with patches through $(ls upstream/patches | grep -v '\.py$' | tail -n 1)"&lt;br /&gt;sed -i -e '/gvimtutor/d' -e "1idebian/tmp/usr/bin/gvimtutor\t\t\t\tusr/bin/" debian/vim-runtime.install.in&lt;br /&gt;dpkg-buildpackage -rfakeroot -uc -b&lt;br /&gt;&lt;/pre&gt;&lt;/pre&gt;Having trouble viewing that?  See the &lt;a href="http://pastie.org/283368"&gt;pastie&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now, you're supposed to have .deb files in the parent directory.  I ran into a problem though in the last line.  Here are the last few lines of output after running dpkg-buildpackage -rfakeroot -uc -b: http://pastie.org/246789&lt;br /&gt;&lt;br /&gt;To fix this, godlygeek asked me to edit vim-7.1/&lt;span&gt;debian/vim-runtime.&lt;wbr&gt;install.in and remove the line with gvimtutor in it.  See my &lt;a href="http://pastie.org/246791"&gt;vim-runtime.install.in file&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So I edited it (gedit &lt;/span&gt;vim-7.1/&lt;span&gt;debian/vim-runtime.&lt;wbr&gt;install.in), then ran the last line (&lt;/span&gt;&lt;pre&gt;dpkg-buildpackage -rfakeroot -uc -b&lt;/pre&gt; &lt;span&gt;in vim-7.1 directory again.&lt;br /&gt;&lt;br /&gt;I got the compiled *.deb files in the parent directory!&lt;br /&gt;&lt;br /&gt;To install them (note that your files will look different):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span&gt;sudo dpkg -i &lt;/span&gt;&lt;span&gt;vim-full_7.1-138+1ubuntu4~ramon1_all.deb&lt;br /&gt;&lt;/span&gt;&lt;span&gt;sudo &lt;/span&gt;&lt;span&gt;dpkg -i vim-gui-common_7.1-138+1ubuntu4~ramon1_all.deb&lt;br /&gt;&lt;/span&gt;&lt;span&gt;sudo &lt;/span&gt;&lt;span&gt;dpkg -i vim-runtime_7.1-138+1ubuntu4~ramon1_all.deb&lt;br /&gt;&lt;/span&gt;&lt;span&gt;sudo &lt;/span&gt;&lt;span&gt;dpkg -i &lt;/span&gt;&lt;span&gt;vim-gnome_7.1-138+1ubuntu4~ramon1_i386.deb&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-7102958404368244256?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/7102958404368244256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=7102958404368244256' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7102958404368244256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7102958404368244256'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/08/installing-latest-gvim-and-vim-in.html' title='Installing the latest gVim and Vim in Ubuntu Hardy Heron'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-6706504804466285729</id><published>2008-07-27T20:35:00.000-07:00</published><updated>2008-07-27T20:36:39.255-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='gvim'/><title type='text'>gVim and placing scripts</title><content type='html'>It seems that everytime I install gVim in Ubuntu the place to put scripts is different.  If anyone can shed some light on this please let me know.  The last time I installed it, I put the scripts in /usr/share/vim/vimcurrent&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6706504804466285729?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6706504804466285729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6706504804466285729' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6706504804466285729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6706504804466285729'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/07/gvim-and-placing-scripts.html' title='gVim and placing scripts'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-1384538444892060811</id><published>2008-06-11T07:08:00.000-07:00</published><updated>2008-06-11T22:50:27.026-07:00</updated><title type='text'>config/initializers/new_rails_defaults.rb and problems with Rails 2.0.2</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span&gt;&lt;span style="font-family:Arial Black;"&gt;I was trying to debug a Rails 2.0.2 app that didn't work on HostingRails.  I froze the gems in the vendor folder and stuff, so that couldn't be the problem.  When I looked at the cPanel error log, I saw this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[Wed Jun 11 08:34:18 2008] [notice] mod_fcgid: process /home/royalpa/public_html/dispatch.fcgi(20133) exit(communication error), terminated by calling exit(), return code: 1&lt;br /&gt;from /home/royalpa/site_files/royalpalm/config/initializers/new_rails_defaults.rb:5&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I never saw new_rails_defaults.rb before so I looked at it and looked at my older Rails apps.  It wasn't there.  I suppose it's there because when you do "rails appname" in hostingrails, it makes a Rails 2.1 skeleton.  It thinks you're going to make a 2.1 app!  Delete it and it should work.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-1384538444892060811?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/1384538444892060811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=1384538444892060811' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1384538444892060811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1384538444892060811'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/06/configinitializersnewrailsdefaultsrb.html' title='config/initializers/new_rails_defaults.rb and problems with Rails 2.0.2'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-3874876501622369109</id><published>2008-05-23T05:09:00.001-07:00</published><updated>2008-08-01T01:41:32.480-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='monit'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='nginx'/><category scheme='http://www.blogger.com/atom/ns#' term='mongrel'/><category scheme='http://www.blogger.com/atom/ns#' term='silverrack'/><category scheme='http://www.blogger.com/atom/ns#' term='gutsy gubbon'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Ruby, Rails, Mongrel, Monit, Nginx on Ubuntu 7.10 Gutsy</title><content type='html'>&lt;h1 id="zb2u0"&gt;                                    Ubuntu 7.10 on SilverRack&lt;/h1&gt;I used to have a tutorial here, and I had gotten the files from an existing server.  I made it for myself.  Since ezra posted making sure I wasn't violating any copyrights, I've decided to take it down, since I can't prove where those files were taken from.&lt;span id="ft7i7"&gt;&lt;span id="ft7i12"&gt;&lt;e.notifier@dummy.com&gt;&lt;/e.notifier@dummy.com&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-3874876501622369109?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/3874876501622369109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=3874876501622369109' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/3874876501622369109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/3874876501622369109'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/05/ruby-rails-mongrel-monit-nginx-on.html' title='Ruby, Rails, Mongrel, Monit, Nginx on Ubuntu 7.10 Gutsy'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-35399769549757418</id><published>2008-05-11T01:16:00.000-07:00</published><updated>2008-05-11T01:26:23.647-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardy heron'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='gvim'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Rails.vim breaks in Hardy Heron</title><content type='html'>Well, Vim breaks when using rails.vim in Ubuntu 8.04 Hardy Heron.  Took me a few days to decide to actually try and fix it and not downgrade back down to Gutsy.&lt;br /&gt;&lt;br /&gt;This post explains what you can do to fix this error.  We'll upgrade to the latest Vim.  Because the error is caused by an old version of Vim and rails.vim, you need to update it.  You can read about it in this &lt;a href="https://bugs.launchpad.net/ubuntu/+source/vim/+bug/219546"&gt;thread&lt;/a&gt;.  That was my starting point to find the fix.&lt;br /&gt;&lt;br /&gt;1) Download and install the latest version of Vim&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;svn co https://vim.svn.sourceforge.net/svnroot/vim/vim7&lt;br /&gt;cd vim7&lt;br /&gt;./configure --with-features=huge&lt;br /&gt;sudo make&lt;br /&gt;sudo make install&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;2) Install all the plugins and scripts again&lt;br /&gt;3) If you use haml, when I downloaded the latest version today of the haml syntax script, I had some illegal carriage return errors.  I had to open haml.vim then save it via&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;:w ++ff=unix&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-35399769549757418?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/35399769549757418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=35399769549757418' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/35399769549757418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/35399769549757418'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/05/railsvim-breaks-in-hardy-heron.html' title='Rails.vim breaks in Hardy Heron'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-8487313474866161672</id><published>2008-03-22T23:56:00.001-07:00</published><updated>2008-03-23T00:03:46.747-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='files'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='attachment_fu'/><title type='text'>GawingAttachable</title><content type='html'>Do you want to be able to attach files to something?  I needed to do that today and I made a plugin called Gawing Attachable (translated: make_attachable).  It allows you to add attachments to something you make attachable.&lt;br /&gt;&lt;br /&gt;Yes, there are many things you can still do to this, but like they say: make something quick and fix it up later on.&lt;br /&gt;&lt;br /&gt;Check out the README before installing.&lt;br /&gt;&lt;pre&gt;script/plugin install http://lucidph.dreamhosters.com/gawing_attachable/trunk&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-8487313474866161672?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/8487313474866161672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=8487313474866161672' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8487313474866161672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8487313474866161672'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/03/gawingattachable.html' title='GawingAttachable'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-7775532664175976723</id><published>2008-03-22T09:35:00.001-07:00</published><updated>2008-03-22T09:41:53.797-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='resources'/><category scheme='http://www.blogger.com/atom/ns#' term='generator'/><title type='text'>Generating a resource in the routes.rb file</title><content type='html'>When making a generator, you may want to add something to the routes.rb file. To understand this you need to know how to make generators.  Take a look at &lt;a href="http://railscasts.com/episodes/58"&gt;Ryan Bates' Railscast&lt;/a&gt; on how to do this.&lt;br /&gt;&lt;br /&gt;To add a normal resource, do it this way:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class GawingFileableGenerator &lt; Rails::Generator::Base&lt;br /&gt;  def manifest&lt;br /&gt;    record do |m|&lt;br /&gt;      ...&lt;br /&gt;      m.route_resources :files&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you want to add other stuff like :member or :collection, do it this way&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class GawingFileableGenerator &lt; Rails::Generator::Base&lt;br /&gt;  def manifest&lt;br /&gt;    record do |m|&lt;br /&gt;      ...&lt;br /&gt;      route_string = ":files, :member =&gt; { :download =&gt; :get }"&lt;br /&gt;      def route_string.to_sym; to_s; end&lt;br /&gt;      def route_string.inspect; to_s; end&lt;br /&gt;      m.route_resources route_string&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-7775532664175976723?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/7775532664175976723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=7775532664175976723' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7775532664175976723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7775532664175976723'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/03/generating-resource-in-routesrb-file.html' title='Generating a resource in the routes.rb file'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-4634625159606349153</id><published>2008-03-12T09:48:00.000-07:00</published><updated>2008-03-12T09:52:16.018-07:00</updated><title type='text'>acts_as_state_machine: make initial state exists!</title><content type='html'>Ugh.. I tried out acts_as_state_machine and I kept getting this nil error and I had no idea why.  I mean, I followed the code in &lt;a href="http://agilewebdevelopment.com/plugins/acts_as_state_machine"&gt;agilewebdevelopment.com&lt;/a&gt; properly.  Here's the code in &lt;a href="http://agilewebdevelopment.com/plugins/acts_as_state_machine"&gt;that website&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;pre&gt;acts_as_state_machine :initial =&gt; :created, :column =&gt; 'status'&lt;br /&gt;&lt;br /&gt;   # These are all of the states for the existing system.&lt;br /&gt;   state :submitted&lt;br /&gt;   state :processing&lt;br /&gt;   state :nonprofit_reviewing&lt;br /&gt;   state :accepted&lt;br /&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Oh... apparently, you need to add&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;state :created&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;to it as well :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-4634625159606349153?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/4634625159606349153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=4634625159606349153' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4634625159606349153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4634625159606349153'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/03/actsasstatemachine-make-initial-state.html' title='acts_as_state_machine: make initial state exists!'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-8439988445595945226</id><published>2008-03-03T23:17:00.000-08:00</published><updated>2008-03-04T18:32:46.707-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plugins'/><category scheme='http://www.blogger.com/atom/ns#' term='got User'/><category scheme='http://www.blogger.com/atom/ns#' term='error'/><category scheme='http://www.blogger.com/atom/ns#' term='expected User'/><category scheme='http://www.blogger.com/atom/ns#' term='force reload'/><title type='text'>Expected User, got User; forcing to reload plugins</title><content type='html'>I made my own plugin and started getting this error.  This plugin is a variation of the acts_as_voteable plugin by Juixe.  I did some searching around, I found this &lt;a href="http://blog.spotstory.com/2007/04/19/upgrading-to-rails-12/"&gt;blog post&lt;/a&gt; that explains the fix.&lt;br /&gt;&lt;br /&gt;Apparently, in development mode, there are issues when it comes to reloading plugins.  Because the model "Vote" in my case, or "Comment" in the blog post's case, is defined inside the plugin, Rails doesn't see that it should load it again.  Anyway, better to read that post for an explanation.&lt;br /&gt;&lt;br /&gt;What I did to fix it was add this code at the end of the environment.rb file:&lt;br /&gt;&lt;pre&gt; # Array of plugins with Application model dependencies.&lt;br /&gt;reloadable_plugins = ["acts_as_commentable"]&lt;br /&gt;&lt;br /&gt;# Force these plugins to reload, avoiding stale object references.&lt;br /&gt;reloadable_plugins.each do |plugin_name|&lt;br /&gt;  reloadable_path = RAILS_ROOT + "/vendor/plugins/#{plugin_name}/lib"&lt;br /&gt;  Dependencies.load_once_paths.delete(reloadable_path)&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://pastie.caboo.se/161576"&gt;See the code&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-8439988445595945226?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/8439988445595945226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=8439988445595945226' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8439988445595945226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8439988445595945226'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/03/expected-user-got-user-forcing-to.html' title='Expected User, got User; forcing to reload plugins'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-4589624106026167119</id><published>2008-02-27T09:07:00.001-08:00</published><updated>2008-02-27T09:15:43.483-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><title type='text'>Creating your own plugin</title><content type='html'>I finally forced myself to make my own plugin instead of having controllers and models all over the place.  Of course, I waited for the right time to make a plugin that wasn't too different, and needed to be different at the same time.&lt;br /&gt;&lt;br /&gt;I chose to make another version of &lt;a href="http://www.juixe.com/techknow/index.php/2006/06/24/acts-as-voteable-rails-plugin/"&gt;acts_as_voteable by Juixe&lt;/a&gt;.  Here are the steps I took&lt;br /&gt;&lt;ol&gt;&lt;li&gt;I watched &lt;a href="http://railscasts.com/episodes/33"&gt;Ryan Bates' screencast on making plugins&lt;/a&gt;&lt;/li&gt;&lt;li&gt;I coped acts_as_voteable and starting editing things one by one to see what broke.&lt;/li&gt;&lt;li&gt;When I needed a clearer and more advanced explanation (like adding helpers and such), I referred to &lt;a href="http://nubyonrails.com/articles/2006/05/04/the-complete-guide-to-rails-plugins-part-i"&gt;Geoffrey G's howto on creating plugins&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt;It took me about 4 hours to figure the whole thing out (I'm a slow learner.. and I already knew about polymorphic associations!).&lt;br /&gt;&lt;br /&gt;The change I had to make to acts_as_voteable was that I had to have 3 kinds of votes: positive, neutral and negative.  Very small change, right? :)&lt;br /&gt;&lt;br /&gt;You can get my plugin like this:&lt;br /&gt;&lt;br /&gt;script/plugin install http://lucidph.dreamhosters.com/gawing_voteable/trunk&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-4589624106026167119?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/4589624106026167119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=4589624106026167119' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4589624106026167119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4589624106026167119'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/02/creating-your-own-plugin.html' title='Creating your own plugin'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-4182081412475609254</id><published>2008-02-25T00:33:00.001-08:00</published><updated>2008-02-25T00:35:54.728-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='highlighting'/><category scheme='http://www.blogger.com/atom/ns#' term='gvim syntax'/><title type='text'>Syntax highlighting</title><content type='html'>I did a fresh install of Ubuntu on my laptop, and I installed gVim (rails.vim) as well.  To my surprise, there was no syntax highlighting!  Good thing a quick ":syntax on" fixed that.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-4182081412475609254?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/4182081412475609254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=4182081412475609254' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4182081412475609254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4182081412475609254'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/02/syntax-highlighting.html' title='Syntax highlighting'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-46132701722975435</id><published>2008-02-08T04:10:00.000-08:00</published><updated>2008-02-08T04:13:03.172-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='define'/><category scheme='http://www.blogger.com/atom/ns#' term='expected'/><category scheme='http://www.blogger.com/atom/ns#' term='error'/><category scheme='http://www.blogger.com/atom/ns#' term='attachment_fu'/><title type='text'>Expected "model.rb" to define Model</title><content type='html'>I was getting this error:&lt;br /&gt;&lt;br /&gt;ActionView::TemplateError (Expected /home/lucidph/public_html/rails/pbed/app/models/article_photo.rb to define ArticlePhoto) on line #5 of articles/gen_xml.xml.builder&lt;br /&gt;&lt;br /&gt;A lot of people get this with ferret and some bug with it, but I didn't have ferret.  The problem: I forgot to upload attachment_fu to the server!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-46132701722975435?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/46132701722975435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=46132701722975435' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/46132701722975435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/46132701722975435'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/02/expected-modelrb-to-define-model.html' title='Expected &quot;model.rb&quot; to define Model'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-5293744955672607505</id><published>2008-02-01T06:17:00.000-08:00</published><updated>2008-02-01T06:39:50.707-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='deploy'/><category scheme='http://www.blogger.com/atom/ns#' term='bluehost'/><title type='text'>Deploying in Bluehost</title><content type='html'>I started writing this entry not knowing what is wrong with my app in Bluehost - except that it isn't running.  I know this because I get a :&lt;br /&gt;&lt;h2&gt;Application error&lt;/h2&gt;Rails application failed to start properly&lt;br /&gt;&lt;br /&gt;1) First I made sure it had &lt;span style="font-weight: bold;"&gt;all the gems&lt;/span&gt; it needed.  Since we wanted to freeze our gems, we had put them in the gem folder.&lt;br /&gt;&lt;br /&gt;I added this to our environment.rb&lt;br /&gt;&lt;br /&gt;ENV['GEM_PATH'] = '/home/YOUR_USERNAME/.gems:/usr/lib/ruby/gems/1.8'&lt;br /&gt;&lt;br /&gt;2) Looking at the production.log, now I see an error.  What's the error?  Among other stuff, the one that's most readable is "Missing helper file helpers/formatting_helper.rb".&lt;br /&gt;&lt;br /&gt;I upload it.&lt;br /&gt;&lt;br /&gt;3) It works.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-5293744955672607505?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/5293744955672607505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=5293744955672607505' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5293744955672607505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5293744955672607505'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/02/deploying-in-bluehost.html' title='Deploying in Bluehost'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-2658836132944147255</id><published>2008-01-22T19:31:00.000-08:00</published><updated>2008-01-22T19:53:04.433-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='array'/><category scheme='http://www.blogger.com/atom/ns#' term='sort_by'/><category scheme='http://www.blogger.com/atom/ns#' term='enumerable'/><category scheme='http://www.blogger.com/atom/ns#' term='sort'/><title type='text'>Sorting an array</title><content type='html'>I was following this &lt;a href="http://www.oreillynet.com/ruby/blog/2005/12/sorting_an_array_of_hashes_wit_2.html"&gt;tutorial&lt;/a&gt; that shows you how to sort an array.  My action looked like this:&lt;br /&gt;&lt;br /&gt;def index&lt;br /&gt;  @articles = NodeType.find(1).nodes + NodeType.find(2).nodes&lt;br /&gt;  @articles.sort_by { |article| article.updated_at }&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;But that didn't work!  It wasn't sorting at all.. at least as far as I could tell.  Strange, because this worked:&lt;br /&gt;&lt;br /&gt;def index&lt;br /&gt;  @articles = NodeType.find(1).nodes + NodeType.find(2).nodes&lt;br /&gt;  @articles = @articles.sort_by { |article| article.updated_at }&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;It seems you have to assign it to an object first, before returning it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-2658836132944147255?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/2658836132944147255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=2658836132944147255' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2658836132944147255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2658836132944147255'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/01/sorting-array.html' title='Sorting an array'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-2458932181239665913</id><published>2008-01-16T20:30:00.000-08:00</published><updated>2008-01-16T20:34:02.937-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='redirect_back_or_default'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='redirect'/><title type='text'>redirect_back_or_default in Rails 2.0</title><content type='html'>Since they removed redirect_back_or_default in Rails 2.0, and I still had a need to do something like that, I made method you can put under the private portion of your ApplicationController:&lt;br /&gt;&lt;br /&gt;  def redirect_back_or(path)&lt;br /&gt;    redirect_to :back&lt;br /&gt;  rescue ActionController::RedirectBackError&lt;br /&gt;    redirect_to path&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;and you use it just like the redirect_back_or_default method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-2458932181239665913?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/2458932181239665913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=2458932181239665913' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2458932181239665913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2458932181239665913'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/01/redirectbackordefault-in-rails-20.html' title='redirect_back_or_default in Rails 2.0'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-9149318984144416655</id><published>2008-01-03T08:32:00.000-08:00</published><updated>2008-01-03T08:37:20.271-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hostingrails'/><category scheme='http://www.blogger.com/atom/ns#' term='markaby'/><category scheme='http://www.blogger.com/atom/ns#' term='templaterror'/><title type='text'>TemplateError, Markaby, HostingRails</title><content type='html'>Markaby in HostingRails causes some TemplateError.  To fix it, in vendor\plugins\markaby\lib\markaby\rails.rb, replace&lt;br /&gt;&lt;br /&gt;compile_and_render_template(template_extension, template, file_path, local_assigns)&lt;br /&gt;&lt;br /&gt;with&lt;br /&gt;&lt;br /&gt;compile_and_render_template(@@template_handlers[template_extension.to_sym], template, file_path, local_assigns)&lt;br /&gt;&lt;br /&gt;source: comments section of a posting in the &lt;a href="http://weblog.rubyonrails.org/2007/12/17/rails-2-0-2-some-new-defaults-and-a-few-fixes"&gt;RoR blog&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-9149318984144416655?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/9149318984144416655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=9149318984144416655' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/9149318984144416655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/9149318984144416655'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2008/01/templateerror-markaby-hostingrails.html' title='TemplateError, Markaby, HostingRails'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-8549457278244870466</id><published>2007-12-13T00:01:00.001-08:00</published><updated>2007-12-13T03:02:46.780-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='test'/><title type='text'>rSpec and Relationships</title><content type='html'>I spend a good 3 hours figuring out why my spec tests were failing.  Let me explain my scenario to you.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;My scenario was pretty much like this: Student belongs to Class.&lt;br /&gt;&lt;br /&gt;My test: a student should know what class it belongs to.&lt;br /&gt;&lt;br /&gt;My student_spec:&lt;br /&gt;&lt;blockquote&gt;it "should know what class it belongs to"&lt;br /&gt;@student = Student.new&lt;br /&gt;@class = Class.new(:name =&gt; "Math")&lt;br /&gt;@class.students &lt;&lt; @student&lt;br /&gt;@student.class.name.should == "Math"&lt;br /&gt;end&lt;/blockquote&gt;Failed!  Apparently, you cannot insert into the array "&lt;&lt;".  You need to do it like this: &lt;blockquote&gt;@student.class = @class&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;Well, I'm not that stupid that it'd take me 3 hours to figure that out!  My test was longer of course! I just made it simple for example's sake. :P&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-8549457278244870466?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/8549457278244870466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=8549457278244870466' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8549457278244870466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8549457278244870466'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/12/rspec-and-relationships.html' title='rSpec and Relationships'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-617424201551341684</id><published>2007-12-03T03:14:00.000-08:00</published><updated>2007-12-03T03:21:10.253-08:00</updated><title type='text'>Rails on Dreamhost</title><content type='html'>Setting up Rails in Dreamhost is a bit tricky.  Dreamhost has a &lt;a href="http://wiki.dreamhost.com/index.php/Ruby_on_Rails"&gt;wiki on how to do it&lt;/a&gt; but as of today, it doesn't work quite right.&lt;br /&gt;&lt;br /&gt;I just installed on and it worked fine so here's how I did it:&lt;br /&gt;&lt;br /&gt;1) If you haven't yet, create the user account through their control panel with FCGI enabled.&lt;br /&gt;2) Log on to the user account that you created via shell.&lt;br /&gt;3) type "rails yourappname"&lt;br /&gt;4) type "rm useraccount.dreamhosters.com" since we'll replace it with a symbolic link.&lt;br /&gt;5) type "ln -s yourappname/public/ useraccount.dreamhosters.com"&lt;br /&gt;6) type "cd yourappname"&lt;br /&gt;7) edit public/.htaccess (make sure what you edited isn't the commented line):&lt;br /&gt;&lt;pre&gt;&lt;code&gt;RewriteRule ^(.*)$ dispatch&lt;b&gt;.cgi&lt;/b&gt; [QSA,L] to &lt;/code&gt;&lt;code&gt;RewriteRule ^(.*)$ dispatch&lt;b&gt;.fcgi&lt;/b&gt; [QSA,L]&lt;/code&gt;&lt;/pre&gt;8) After &lt;code&gt;require 'fcgi_handler'&lt;/code&gt;, change the rest of dispatch.fcgi to read:  &lt;pre&gt;class RailsFCGIHandler&lt;br /&gt;private&lt;br /&gt;  def frao_handler(signal)&lt;br /&gt;    dispatcher_log :info, "asked to terminate immediately"&lt;br /&gt;    dispatcher_log :info, "frao handler working its magic!"&lt;br /&gt;    restart_handler(signal)&lt;br /&gt;  end&lt;br /&gt;  alias_method :exit_now_handler, :frao_handler&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;RailsFCGIHandler.process!&lt;br /&gt;&lt;/pre&gt;9) edit your config/environment.rb and uncomment the line:&lt;br /&gt;ENV['RAILS_ENV'] ||= 'production'&lt;br /&gt;&lt;br /&gt;10) Your Rails app should be working fine now.  You'll need to edit the database.yml and stuff to make sure that you can connect to the database of course.&lt;br /&gt;&lt;br /&gt;Goodluck!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-617424201551341684?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/617424201551341684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=617424201551341684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/617424201551341684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/617424201551341684'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/12/rails-on-dreamhost.html' title='Rails on Dreamhost'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-1881869719417476916</id><published>2007-11-16T00:30:00.000-08:00</published><updated>2007-11-16T01:08:36.867-08:00</updated><title type='text'>Onto Rails and rSpec</title><content type='html'>Like I mentioned yesterday, I started trying out rSpec.  When in Rails, it's a little different.  You need to include more stuff.  I couldn't get my spec to run properly.  Apparently, you have to import a bunch of stuff:&lt;br /&gt;&lt;br /&gt;require File.dirname(__FILE__) + '/../../config/boot'&lt;br /&gt;require "#{RAILS_ROOT}/config/environment"&lt;br /&gt;require File.dirname(__FILE__) + '/../../app/models/project_management'&lt;br /&gt;&lt;br /&gt;The first two lines I got from the &lt;a href="http://http://codehappy.wordpress.com"&gt;codehappy&lt;/a&gt; &lt;a href="http://codehappy.wordpress.com/2006/12/"&gt;blog post&lt;/a&gt;.  The third just imports the model I'm testing out.&lt;br /&gt;&lt;br /&gt;I may be doing it completely wrong so I'd appreciate any feed back.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-1881869719417476916?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/1881869719417476916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=1881869719417476916' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1881869719417476916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1881869719417476916'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/11/onto-rails-and-rspec.html' title='Onto Rails and rSpec'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-6346823620966080818</id><published>2007-11-15T02:08:00.000-08:00</published><updated>2007-11-15T02:10:59.781-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='subversion'/><category scheme='http://www.blogger.com/atom/ns#' term='command line'/><category scheme='http://www.blogger.com/atom/ns#' term='svn'/><title type='text'>Command line Subversion, Rails</title><content type='html'>Like I mentioned on my earlier post, I'm a slow learner when I read manuals.  I like watching much more.  Check out &lt;a href="http://railscasts.com/episodes/36"&gt;episode 36&lt;/a&gt; on &lt;a href="http://railscasts.com"&gt;Railscasts&lt;/a&gt;.  It gives a nice quick overview on how it's done on the Mac.  It's the same on Linux.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6346823620966080818?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6346823620966080818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6346823620966080818' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6346823620966080818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6346823620966080818'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/11/command-line-subversion-rails.html' title='Command line Subversion, Rails'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-7375204778343042533</id><published>2007-11-15T01:44:00.000-08:00</published><updated>2007-11-15T01:58:51.457-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='bdd'/><title type='text'>Learning Behaviour Driven Development</title><content type='html'>I've been doing a bunch of Google searches on Behaviour Driven Development (BDD) but all I've found were long articles and wordy introductions.  I suppose some people learn that way but I'm way to lazy.&lt;br /&gt;&lt;br /&gt;Thank goodness for screencasts.  To dive into it, check out the website &lt;a href="http://smartic.us"&gt;smartic.us&lt;/a&gt;' &lt;a href="http://smartic.us/smarticast"&gt;screencasts on rSpec&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Obviously, I don't know much.  All I know is that rSpec is a gem used for testing.  He dives straight into making a class and testing it.  Or rather, testing it, then making the class.  You'll see. :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-7375204778343042533?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/7375204778343042533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=7375204778343042533' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7375204778343042533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7375204778343042533'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/11/learning-behaviour-driven-development.html' title='Learning Behaviour Driven Development'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-4423586185010949172</id><published>2007-11-10T00:47:00.000-08:00</published><updated>2007-11-10T01:03:30.844-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='gvim'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Ubuntu and gVim</title><content type='html'>I've always been a Windows or DOS user ever since childhood. In the past several years I have tried to migrate to Linux.&lt;br /&gt;    Here comes in Ruby on Rails... on gVim... on... Ubuntu. It's nice and fast. you feel like you put your computer on steroids.   Enough talk. Let me share with you the simple steps I took to install it.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Install Ruby on Rails so that gVim may be able to access whatever files are in the RoR install.&lt;/li&gt;&lt;li&gt;Go to http://www.cs.cornell.edu/w8/~djm/ubuntu/gutsy/#gvim and follow the installation instructions for gVim.&lt;/li&gt;&lt;li&gt;Go back to my earlier post on Vim and you may follow that and paste the custom files in the gVim ~/.vim/ (which is equivalent to the Window's ~/vimfiles/ folder).&lt;/li&gt;&lt;/ol&gt;Happy geek out!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-4423586185010949172?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/4423586185010949172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=4423586185010949172' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4423586185010949172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4423586185010949172'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/11/ubuntu-and-gvim.html' title='Ubuntu and gVim'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-8241263855295999771</id><published>2007-10-25T23:43:00.000-07:00</published><updated>2007-10-25T23:53:39.835-07:00</updated><title type='text'>Running Multiple servers</title><content type='html'>Now this really isn't a hack for rails or a fix. Its a nice little thing built into rails that I just started using. Its running multiple rails programs on a localhost for testing.&lt;br /&gt;Basically, the jist is you can run several RoR servers on the same computer as long as the ports are different.&lt;br /&gt;&lt;br /&gt;To achieve this when you run a RoR server with the command :&lt;br /&gt;ruby script/server&lt;br /&gt;you can add a port option by adding -p and specifying the port number:&lt;br /&gt;ruby script/server -p 3001&lt;br /&gt;&lt;br /&gt;the default port is 3000, and you can't run multiple servers on a localhost without specifiying a port.&lt;br /&gt;&lt;br /&gt;you can also use :Rserver -p 3001 if you are running it on Vim&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-8241263855295999771?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/8241263855295999771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=8241263855295999771' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8241263855295999771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8241263855295999771'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/10/running-multiple-servers.html' title='Running Multiple servers'/><author><name>migsam</name><uri>http://www.blogger.com/profile/05230201237975496803</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-6055214834087664240.post-8391543031111450871</id><published>2007-10-24T23:03:00.001-07:00</published><updated>2007-10-24T23:05:20.723-07:00</updated><title type='text'>Tackling VIM</title><content type='html'>Two posts ago I was talking about the RoR talk that Guy gave.  Since then, I've learned how to use VIM.  There is a bit of a learning curve but you'll see you'll start to work a lot faster about 2 days of continuous use (sleep is ok).&lt;br /&gt;&lt;br /&gt;I've found &lt;a href="http://ruby.about.com/b/a/000095.htm"&gt;T Pope's article&lt;/a&gt; to be very useful.  Read that and all the links in the article and the preceding articles.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-8391543031111450871?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/8391543031111450871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=8391543031111450871' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8391543031111450871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8391543031111450871'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/10/tackling-vim.html' title='Tackling VIM'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-6850977436621348919</id><published>2007-10-24T22:59:00.001-07:00</published><updated>2007-10-24T23:02:18.151-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rest'/><title type='text'>Stumbling into REST</title><content type='html'>I stumbled into REST accidentally about 1 month ago.  Since then, I've learned to try (at least) to make the URLs more beautiful and this simplifying the sites that I create.  Here are some resources I've found to be quite useful:&lt;br /&gt;&lt;br /&gt;1) &lt;a href="http://www.scribemedia.org/2006/07/09/dhh/"&gt;DHH's 2006 keynote&lt;/a&gt;&lt;br /&gt;2) Episodes &lt;a href="http://railscasts.com/episodes/35"&gt;35&lt;/a&gt; and &lt;a href="http://railscasts.com/episodes/67"&gt;67&lt;/a&gt; of &lt;a href="http://railscasts.com/"&gt;Railscasts&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If anyone can add to this list, please drop a comment!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6850977436621348919?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6850977436621348919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6850977436621348919' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6850977436621348919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6850977436621348919'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/10/stumbling-into-rest.html' title='Stumbling into REST'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-4528297532311043370</id><published>2007-10-11T02:59:00.000-07:00</published><updated>2007-10-11T03:57:40.224-07:00</updated><title type='text'>PhRUG Ruby on Rails Talk</title><content type='html'>I went to a RoR talk last night in Ortigas.  It was sponsored by &lt;a href="http://exist.com/"&gt;Exist&lt;/a&gt;.  The speaker was Guy Naor, the CTO of &lt;a href="http://morphlabs.com/"&gt;Morph Labs&lt;/a&gt;.  Because he mentioned a bunch of stuff that I need to remember, here's a list of things people and I should do or at least look into if they are into Ruby on Rails:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Continuous Integration&lt;/li&gt;&lt;li&gt;Capistrano and SVN&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Ruby Way by Hal Fulton&lt;/li&gt;&lt;li&gt;Test Driven Development&lt;/li&gt;&lt;li&gt;Behaviour Driven Development&lt;/li&gt;&lt;li&gt;Vim &amp;amp; Rails&lt;/li&gt;&lt;li&gt;Know your regular expressions!&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;I've looked into these before but I didn't take that much importance to them.  Now I know I should look into it some more!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-4528297532311043370?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/4528297532311043370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=4528297532311043370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4528297532311043370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4528297532311043370'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/10/phrug-ruby-on-rails-talk.html' title='PhRUG Ruby on Rails Talk'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-4347883226922027898</id><published>2007-10-03T21:27:00.000-07:00</published><updated>2007-10-03T21:30:06.342-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file upload'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='attachment_fu'/><category scheme='http://www.blogger.com/atom/ns#' term='upload'/><title type='text'>You can't upload files via ajax alone!</title><content type='html'>Spent the morning figuring out something you can't do!  I was trying to make an ajax file uploader but kept running into problems.  I asked around #rubyonrails in freenode but got no answer so I did some searching... and found &lt;a href="http://beast.caboo.se/forums/2/topics/817"&gt;a thread&lt;/a&gt; of this person that tried to do the exact same thing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-4347883226922027898?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/4347883226922027898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=4347883226922027898' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4347883226922027898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/4347883226922027898'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/10/you-cant-upload-files-via-ajax-alone.html' title='You can&apos;t upload files via ajax alone!'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-3706760348391232138</id><published>2007-10-02T01:36:00.000-07:00</published><updated>2007-10-02T01:38:15.870-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='toggle'/><category scheme='http://www.blogger.com/atom/ns#' term='helper'/><category scheme='http://www.blogger.com/atom/ns#' term='hidden div'/><title type='text'>helper: Toggler</title><content type='html'>I made a &lt;a href="http://pastie.caboo.se/102817"&gt;new helper&lt;/a&gt; to help out with toggling a div.  To make sure the div is invisible upon load, make sure you add the style="display: none;" in the div.&lt;br /&gt;&lt;br /&gt;To call the helper, use it like this:&lt;br /&gt;&lt;br /&gt;&lt;%= toggler("click me to open that div", "div-id") %&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-3706760348391232138?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/3706760348391232138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=3706760348391232138' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/3706760348391232138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/3706760348391232138'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/10/helper-toggler.html' title='helper: Toggler'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-6356546441035826986</id><published>2007-09-26T01:23:00.000-07:00</published><updated>2007-09-26T01:24:55.789-07:00</updated><title type='text'>helper: s_to_hh_mm_ss</title><content type='html'>Convert seconds to hh:mm:ss&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  def s_to_hh_mm_ss(number)&lt;br /&gt;    seconds = "%02d" % (number % 6)&lt;br /&gt;    minutes = "%02d" % ( (number / 60 ) % 60)&lt;br /&gt;    hours = "%02d" % ( (number / 3600) % 24) &lt;br /&gt;   &lt;br /&gt;    return (hours + minutes + seconds).scan(/../).join(':')&lt;br /&gt;  end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6356546441035826986?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6356546441035826986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6356546441035826986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6356546441035826986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6356546441035826986'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/helper-stohhmmss.html' title='helper: s_to_hh_mm_ss'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-5088627665877790813</id><published>2007-09-25T07:29:00.000-07:00</published><updated>2007-10-05T03:29:01.915-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='check_box'/><category scheme='http://www.blogger.com/atom/ns#' term='helper'/><title type='text'>helper: check_box_collection</title><content type='html'>Following the Lynda.com RoR video tutorials, you're taught how to make code for checkboxes.  It's a bit of a hassle because there's a lot of cutting and pasting per checkbox collection you want to have.  With the following code, you just paste several times to get things working.&lt;br /&gt;&lt;br /&gt;I couldn't find a way to display this properly in blogger, so I posted that code in pastie.&lt;br /&gt;Helper: &lt;a href="http://pastie.caboo.se/104016"&gt;http://pastie.caboo.se/104016&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Code you will put in the model that will "contain the check list".  For example, if a user has_and_belongs_to_many :roles, this code will be pasted on the User model.&lt;br /&gt;&lt;a href="http://pastie.caboo.se/100607"&gt;http://pastie.caboo.se/100607&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then, when you want to generate the checklist, simply paste this in your view:&lt;br /&gt;&lt;a href="http://pastie.caboo.se/100609"&gt;http://pastie.caboo.se/100609&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When updating or saving, make sure you tell the user (or the model that has the checklist) to update!  I used mine the following way in the controller:&lt;br /&gt;&lt;a href="http://pastie.caboo.se/100608"&gt;http://pastie.caboo.se/100608&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-5088627665877790813?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/5088627665877790813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=5088627665877790813' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5088627665877790813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/5088627665877790813'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/helper-checkboxcollection.html' title='helper: check_box_collection'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-6134122311677696804</id><published>2007-09-25T07:28:00.001-07:00</published><updated>2008-01-06T19:25:51.056-08:00</updated><title type='text'>helper: collection_for_select</title><content type='html'>I didn't find the form helper that made collection select tags powerful enough, so I made my own.  I don't know how to make a nice plugin yet, so it's still a helper.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pastie.caboo.se/135986"&gt;Code&lt;/a&gt; is in pastie.&lt;br /&gt;&lt;br /&gt;Put the "helper" section code in your helper file:&lt;br /&gt;&lt;br /&gt;For usage, put the code in the "usage" section in your rhtml.&lt;br /&gt;&lt;br /&gt;Notes:&lt;br /&gt;&lt;br /&gt;* selected_value will only work with integers!  It's possible this'll be changed in the future.&lt;br /&gt;&lt;br /&gt;[EDIT]&lt;br /&gt;2007-01-03: I changed the pastie code so an error won't be generated even if selected_value is nil&lt;br /&gt;&lt;br /&gt;[EDIT]&lt;br /&gt;2007-01-07: If the collection passed is empty, 2 things happen:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The first option with value 0 is "Empty list"&lt;/li&gt;&lt;li&gt;The list is disabled.&lt;/li&gt;&lt;/ol&gt;If you want to change the message when the list is empty, in the options hash, pass :empty_message&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6134122311677696804?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6134122311677696804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6134122311677696804' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6134122311677696804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6134122311677696804'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/helper-collectionforselect.html' title='helper: collection_for_select'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-2123829372788840167</id><published>2007-09-25T07:27:00.001-07:00</published><updated>2007-09-25T07:27:54.353-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='scriptaculous'/><category scheme='http://www.blogger.com/atom/ns#' term='form.serialize'/><title type='text'>tip: When editing JS, check all that depend on it</title><content type='html'>The Form.serialize broke when I replaced scriptaculous.js with &lt;a href="http://readlist.com/lists/lists.rubyonrails.org/rails/2/10114.html"&gt;another version&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-2123829372788840167?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/2123829372788840167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=2123829372788840167' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2123829372788840167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2123829372788840167'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/tip-when-editing-js-check-all-that.html' title='tip: When editing JS, check all that depend on it'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-2823758417589645715</id><published>2007-09-25T07:26:00.000-07:00</published><updated>2007-09-25T07:27:06.534-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='log'/><category scheme='http://www.blogger.com/atom/ns#' term='tail'/><title type='text'>tip: tailing logs</title><content type='html'>You can call this command in Linux to watch a log file as it updates:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;tail -f [path/to/filename]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This actually works with all text files.&lt;br /&gt;&lt;br /&gt;If you're in Windows, there's no built in DOS command that does it.  If you're using Aptana/RadRails, you can right click on the file you want to watch and it'll come out in the console window.&lt;br /&gt;&lt;br /&gt;This will remove the hassle of opening and closing the logs whenever we want to see something.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-2823758417589645715?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/2823758417589645715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=2823758417589645715' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2823758417589645715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2823758417589645715'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/tip-tailing-logs.html' title='tip: tailing logs'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-1362734882372659965</id><published>2007-09-25T07:25:00.000-07:00</published><updated>2007-09-25T07:26:09.741-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reserved words'/><category scheme='http://www.blogger.com/atom/ns#' term='tip'/><title type='text'>tip: Not using Reserved Words!</title><content type='html'>Spent 3 hours debugging something - and found out I was using a buggy word / reserved word -- 'display'!  Make sure you read the &lt;a href="http://wiki.rubyonrails.org/rails/pages/ReservedWords"&gt;ReservedWords wiki page&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-1362734882372659965?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/1362734882372659965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=1362734882372659965' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1362734882372659965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1362734882372659965'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/tip-not-using-reserved-words.html' title='tip: Not using Reserved Words!'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-6764597813419220990</id><published>2007-09-25T07:23:00.000-07:00</published><updated>2007-09-25T07:25:01.748-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='url'/><category scheme='http://www.blogger.com/atom/ns#' term='full url'/><category scheme='http://www.blogger.com/atom/ns#' term='helper'/><title type='text'>helper: Getting the full URL</title><content type='html'>There’s nothing built in Rails that gives you the full URL. I made a helper, that gives this to you. It doesn’t display properly here.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  def get_full_url(base_url)&lt;br /&gt;    return base_url + request.path + get_params_as_url_friendly&lt;br /&gt;  end&lt;br /&gt;  &lt;br /&gt;  def get_params_as_url_friendly&lt;br /&gt;    count = 0&lt;br /&gt;    param_size = request.query_parameters.size&lt;br /&gt;    parameters = ""&lt;br /&gt;    &lt;br /&gt;    for param in request.query_parameters&lt;br /&gt;      parameter = "#{param[0]}=#{param[1]}"&lt;br /&gt;      &lt;br /&gt;      if count == 0&lt;br /&gt;        parameter = "?#{parameter}"&lt;br /&gt;      else&lt;br /&gt;        parameter = "&amp;#{parameter}"&lt;br /&gt;      end&lt;br /&gt;      &lt;br /&gt;      count += 1&lt;br /&gt;      parameters += parameter&lt;br /&gt;    end&lt;br /&gt;    &lt;br /&gt;    return parameters&lt;br /&gt;  end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6764597813419220990?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6764597813419220990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6764597813419220990' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6764597813419220990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6764597813419220990'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/helper-getting-full-url.html' title='helper: Getting the full URL'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6055214834087664240.post-2025096736505515724</id><published>2007-09-25T07:22:00.000-07:00</published><updated>2007-09-25T07:23:16.007-07:00</updated><title type='text'>tip: Going Live with Attachment_fu</title><content type='html'>This problem popped up in HostingRails.com, and I was using attachment_fu.  If you're going live somewhere and you're using attachment_fu, read &lt;a href="http://www.hostingrails.com/forums/deployment_troubleshooting_thread/518"&gt;this thread&lt;/a&gt; if you run across errors accessing models that use attachment_fu!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-2025096736505515724?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/2025096736505515724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=2025096736505515724' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2025096736505515724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2025096736505515724'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/tip-going-live-with-attachmentfu.html' title='tip: Going Live with Attachment_fu'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-6908797769214346390</id><published>2007-09-25T07:21:00.000-07:00</published><updated>2007-09-25T07:22:32.509-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='foreign keys'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Tutorial: Foreign Keys with Different Names</title><content type='html'>I had to make private messages that had a sender_id and a recipient_id that both referred to the user table.  Here's how the model should look:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class PrivateMessage &lt; ActiveRecord::Base&lt;br /&gt;  belongs_to :sender, :class_name =&gt; "User", :foreign_key =&gt; "sender_id"&lt;br /&gt;  belongs_to :recipient, :class_name =&gt; "User", :foreign_key =&gt; "recipient_id"&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6908797769214346390?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6908797769214346390/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6908797769214346390' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6908797769214346390'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6908797769214346390'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/tutorial-foreign-keys-with-different.html' title='Tutorial: Foreign Keys with Different Names'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-1019195667511212221</id><published>2007-09-25T07:20:00.000-07:00</published><updated>2007-09-25T07:21:23.350-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='habtm'/><category scheme='http://www.blogger.com/atom/ns#' term='id'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='migrations'/><title type='text'>Tutorial: Migration Table w/o IDs</title><content type='html'>When creating HABTM(Has And Belongs To Many) tables, you can create the migration table without an ID column this way:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    create_table :events_users, :id =&gt; false do |t|&lt;br /&gt;      t.column :event_id, :integer&lt;br /&gt;      t.column :user_id, :integer&lt;br /&gt;    end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-1019195667511212221?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/1019195667511212221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=1019195667511212221' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1019195667511212221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1019195667511212221'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/tutorial-migration-table-wo-ids.html' title='Tutorial: Migration Table w/o IDs'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-1720133931966356061</id><published>2007-09-25T07:19:00.000-07:00</published><updated>2007-09-25T07:20:05.270-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='toturoal'/><category scheme='http://www.blogger.com/atom/ns#' term='attachment_fu'/><title type='text'>Tutorial: attachment_fu: fixing the Windows error on size</title><content type='html'>It took me a while to find this, but I finally found my answer in a &lt;a href="http://www.railsforum.com/viewtopic.php?pid=26427#p26427"&gt;forum thread&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-1720133931966356061?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/1720133931966356061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=1720133931966356061' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1720133931966356061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1720133931966356061'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/tutorial-attachmentfu-fixing-windows.html' title='Tutorial: attachment_fu: fixing the Windows error on size'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-7057168017230827485</id><published>2007-09-25T07:09:00.001-07:00</published><updated>2007-09-25T07:19:18.003-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file_column'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Tutorial: Fixing file_column's permissions</title><content type='html'>I came across a problem with file_column because it didn't update the permissions of the files and folders where you'd upload.&lt;br /&gt;&lt;br /&gt;They'd stay at 600.  I'd come across a routing error when trying to download files.&lt;br /&gt;&lt;br /&gt;In the file_column.rb I edited the move_from method to look like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    def move_from(local_dir, just_uploaded)&lt;br /&gt;      # create a directory named after the primary key, first&lt;br /&gt;      unless File.exists?(@dir)&lt;br /&gt;        FileUtils.mkdir(@dir)&lt;br /&gt;        #sets the permissions just in case it hasn't been set.&lt;br /&gt;        FileUtils.chmod_R 0755, @dir &lt;br /&gt;      end&lt;br /&gt;      &lt;br /&gt;      # move the temporary files over&lt;br /&gt;      FileUtils.cp Dir.glob(File.join(local_dir, "*")), @dir&lt;br /&gt;      &lt;br /&gt;      @just_uploaded = just_uploaded&lt;br /&gt;&lt;br /&gt;      # remove all old files in the directory&lt;br /&gt;      FileUtils.rm(Dir.glob(File.join(@dir, "*")).reject! {&lt;br /&gt;                     |e| File.exists?(File.join(local_dir, File.basename(e)))&lt;br /&gt;                   })&lt;br /&gt;      &lt;br /&gt;    end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Since posting this, we've moved to attachment_fu.  It's a lot nicer, but has a steeper learning curve.  If you're learning on how to attach files, file_column is fine.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-7057168017230827485?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/7057168017230827485/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=7057168017230827485' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7057168017230827485'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/7057168017230827485'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/tutorial-fixing-filecolumns-permissions.html' title='Tutorial: Fixing file_column&apos;s permissions'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-61046133327012964</id><published>2007-09-25T06:54:00.000-07:00</published><updated>2007-09-25T06:55:33.872-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='number'/><category scheme='http://www.blogger.com/atom/ns#' term='helper'/><category scheme='http://www.blogger.com/atom/ns#' term='currency'/><title type='text'>helper: number_to_php</title><content type='html'>Here's a helper to convert a number to Philippine Pesos.  For other currencies, just replace the symbol.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  def number_to_php(amt)&lt;br /&gt;    return number_to_currency(amt, :unit =&gt; "PHP ")&lt;br /&gt;  end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-61046133327012964?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/61046133327012964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=61046133327012964' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/61046133327012964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/61046133327012964'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/helper-numbertophp.html' title='helper: number_to_php'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-908475995706072877</id><published>2007-09-25T06:51:00.000-07:00</published><updated>2007-09-25T06:53:51.240-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='email'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='authentication'/><title type='text'>Tutorial: Email Authentication When Signing Up</title><content type='html'>This is to help us remember how to do email authentication (emailing the password to the user, so that they can use that to log in) when signing up.&lt;br /&gt;&lt;br /&gt;This assumes you're using the LoginGenerator.&lt;br /&gt;&lt;br /&gt;1. In account_controller.rb, add this as a private method:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def generate_password(length = 8)&lt;br /&gt;  chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('1'..'9').to_a - ['o', 'O', 'i', 'I']&lt;br /&gt;  Array.new(length) { chars[rand(chars.size)] }.join&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2. Then add/edit this method to the account_controller.rb&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def signup&lt;br /&gt;    case @request.method&lt;br /&gt;      when :post&lt;br /&gt;        @password = generate_password&lt;br /&gt;&lt;br /&gt;        @user = User.new(@params['user'])&lt;br /&gt;        @user.password = @password&lt;br /&gt;       &lt;br /&gt;        if @user.save     &lt;br /&gt;          #@session['user'] = User.authenticate(@user.login, @params['user']['password'])&lt;br /&gt;          Notifier::deliver_account_details(@user, @password)&lt;br /&gt;          flash['notice']  = "An email has been sent."&lt;br /&gt;          redirect_to :action =&gt; "login"&lt;br /&gt;        end&lt;br /&gt;      when :get&lt;br /&gt;        @user = User.new&lt;br /&gt;    end     &lt;br /&gt;  end &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;3. Make the notifier:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ruby script/generate model Notifier&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;4. Make the method that takes care of the emailing in notifier.rb:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class Notifier &lt; ActionMailer::Base&lt;br /&gt;  def account_details(user,password)&lt;br /&gt;    # Email header info MUST be added here&lt;br /&gt;    @recipients = user.email&lt;br /&gt;    @from = "noreply@domain.com"&lt;br /&gt;    @subject = "Account Details"&lt;br /&gt; &lt;br /&gt;    # Email body substitutions go here&lt;br /&gt;    @body["username"] = user.login&lt;br /&gt;    @body["password"] = password&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;5. Create views/notifier/account_details.rhtml like this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Hello &lt;%= @username %&gt;,&lt;br /&gt;&lt;br /&gt;Your password is:&lt;br /&gt;&lt;%= @password %&gt;&lt;br /&gt;&lt;br /&gt;When you log in, please change your password for security.&lt;br /&gt;&lt;br /&gt;Thank you,&lt;br /&gt;Mailman&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;6. Finally, add this to the bottom of config/environment.rb:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ActionMailer::Base.smtp_settings = {&lt;br /&gt;  :address  =&gt; "mail.domain.com",&lt;br /&gt;  :port  =&gt; 25, #some servers use 26 - I got stuck here before!&lt;br /&gt;  :domain  =&gt; 'www.domain.com',&lt;br /&gt;  :user_name  =&gt; "info@domain.com",&lt;br /&gt;  :password  =&gt; "pass",&lt;br /&gt;  :authentication  =&gt; :login&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-908475995706072877?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/908475995706072877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=908475995706072877' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/908475995706072877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/908475995706072877'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/tutorial-email-authentication-when.html' title='Tutorial: Email Authentication When Signing Up'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-9187791541276292802</id><published>2007-09-25T06:49:00.000-07:00</published><updated>2007-09-25T06:51:04.358-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='password'/><category scheme='http://www.blogger.com/atom/ns#' term='method'/><title type='text'>method: generate_password</title><content type='html'>Generate a password.  Make sure this goes hand-in-hand with encryption.  You don't want to store passwords as-is in databases.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def generate_password(length = 6)&lt;br /&gt;  chars = ('a'..'z').to_a + ('A'..'Z').to_a + ('1'..'9').to_a - ['o', 'O', 'i', 'I']&lt;br /&gt;  Array.new(length) { chars[rand(chars.size)] }.join&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I got this from "here":http://www.rubyonrailsblog.com/articles/2006/09/29/ruby-on-rails-random-password-generator.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-9187791541276292802?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/9187791541276292802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=9187791541276292802' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/9187791541276292802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/9187791541276292802'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/method-generatepassword.html' title='method: generate_password'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-8130760665952580970</id><published>2007-09-25T06:47:00.000-07:00</published><updated>2007-09-25T06:48:38.613-07:00</updated><title type='text'>plugin: relative dates</title><content type='html'>For relative dates: today, yesterday, etc.&lt;br /&gt;&lt;br /&gt;Run&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ruby script/plugin install http://ar-code.svn.engineyard.com/plugins/relative_time_helpers/&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;See this for more details:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;%= relative_time(Time.now) %&gt;&lt;br /&gt;# today&lt;br /&gt;&lt;%= relative_time(1.day.ago) %&gt;&lt;br /&gt;# yesterday&lt;br /&gt;&lt;%= relative_time(1.day.from_now) %&gt;&lt;br /&gt;# tomorrow&lt;br /&gt;&lt;%= relative_time_span([Time.now, 5.days.from_now]) %&gt;&lt;br /&gt;# May 17th - 22nd&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I got it from http://activereload.net/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-8130760665952580970?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/8130760665952580970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=8130760665952580970' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8130760665952580970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8130760665952580970'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/plugin-relative-dates.html' title='plugin: relative dates'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-2737141867746460635</id><published>2007-09-25T06:41:00.000-07:00</published><updated>2007-09-25T06:45:28.255-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='acl system'/><category scheme='http://www.blogger.com/atom/ns#' term='helper'/><category scheme='http://www.blogger.com/atom/ns#' term='aclsystem'/><title type='text'>Helper: user_authorized?</title><content type='html'>When using ACLSystem, you can check if someone has permission to do something.  However, before you ask, you have to make sure the user is logged in in the first place.  Instead of having all that code in the view, I made a helper so that we won't have to check and see if the &lt;pre&gt;session['user'].nil?&lt;/pre&gt; each time we want to ask if the user has permission to do so.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def user_authorized?(perm) #works with ACL controller&lt;br /&gt; return session['user'].authorized?(perm) if not session['user'].nil?&lt;br /&gt; return false&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-2737141867746460635?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/2737141867746460635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=2737141867746460635' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2737141867746460635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/2737141867746460635'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/helper-userauthorized.html' title='Helper: user_authorized?'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-8707833606538474532</id><published>2007-09-25T06:38:00.001-07:00</published><updated>2007-09-25T06:40:55.561-07:00</updated><title type='text'>Documentation</title><content type='html'>The world of Ruby on Rails doesn't have particularly complete documentation.  When looking for a way to convert datetime to a date, I couldn't find a way.  I searched in &lt;a href="http://gotapi.com/rubyrails"&gt;gotapi.com&lt;/a&gt; but found nothing.&lt;br /&gt;&lt;br /&gt;I went to the #rubyonrails chatroom in EFNet and I was pointed to &lt;a href="http://www.ruby-doc.org/"&gt;ruby-doc - another documentation site&lt;/a&gt; that I've found to be the best.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-8707833606538474532?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/8707833606538474532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=8707833606538474532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8707833606538474532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/8707833606538474532'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/documentation.html' title='Documentation'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-3288700089960924657</id><published>2007-09-25T06:36:00.000-07:00</published><updated>2007-09-25T06:37:55.835-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='url'/><category scheme='http://www.blogger.com/atom/ns#' term='helper'/><title type='text'>Helper: get_url(url)</title><content type='html'>Answer to making our relative URLs to absolute URLs through the application helper:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def get_url(url)&lt;br /&gt;  return "http://localhost:3000" + url&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If URL were /model/file/1/a.jpg, then you'd get http://localhost:3000/model/file/1/a.jpg in return.  When moving to a new webserver, we just need to edit the helper and change the base URL.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-3288700089960924657?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/3288700089960924657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=3288700089960924657' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/3288700089960924657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/3288700089960924657'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/helper-geturlurl.html' title='Helper: get_url(url)'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-1512837295604397952</id><published>2007-09-25T06:34:00.000-07:00</published><updated>2007-09-25T06:36:01.577-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='helper'/><category scheme='http://www.blogger.com/atom/ns#' term='time'/><category scheme='http://www.blogger.com/atom/ns#' term='milliseconds'/><title type='text'>Helper: ms_to_hh_mm_ss(number)</title><content type='html'>Convert a number (milliseconds) the format hh:mm:ss&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;def ms_to_hh_mm_ss(number)&lt;br /&gt;  seconds = "%02d" % (number % 6)&lt;br /&gt;  minutes = "%02d" % ( (number / 60000 ) % 60)&lt;br /&gt;  hours = "%02d" % ( (number / 3600000) % 24) &lt;br /&gt; &lt;br /&gt;  return (hours + minutes + seconds).scan(/../).join(':')&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Place this in the applications_helper.rb to make it available everywhere in the application.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-1512837295604397952?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/1512837295604397952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=1512837295604397952' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1512837295604397952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/1512837295604397952'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/helper-mstohhmmssnumber.html' title='Helper: ms_to_hh_mm_ss(number)'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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-6055214834087664240.post-6320907791827131059</id><published>2007-09-25T06:20:00.000-07:00</published><updated>2007-09-25T06:30:12.987-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='introduction'/><title type='text'>World of Notes</title><content type='html'>We used to post our code notes - Ruby on Rails notes, CSS notes, etc - in a password protected site.. when we realized we could just as easily share this information with others.&lt;br /&gt;&lt;br /&gt;In this blog you'll find posts by different people in the team, talking about the little things we run to everyday, and how to solve them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6055214834087664240-6320907791827131059?l=railshacks.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railshacks.blogspot.com/feeds/6320907791827131059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6055214834087664240&amp;postID=6320907791827131059' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6320907791827131059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6055214834087664240/posts/default/6320907791827131059'/><link rel='alternate' type='text/html' href='http://railshacks.blogspot.com/2007/09/world-of-notes.html' title='World of Notes'/><author><name>Ramon</name><uri>http://www.blogger.com/profile/16360440870111079337</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></feed>
