<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-19115874</id><updated>2024-08-29T20:39:18.813-07:00</updated><category term="ruby on rails"/><category term="Mac OS X"/><category term="Tips"/><category term="deprecation"/><category term="migrations"/><category term="quirk"/><title type='text'>NoobOnRails</title><subtitle type='html'>Ruby on Rails tips, tricks and hints for the aspiring rails hero.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default?alt=atom'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default?alt=atom&amp;start-index=26&amp;max-results=25'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>58</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-19115874.post-6282601096334634288</id><published>2007-04-27T00:25:00.000-07:00</published><updated>2007-04-27T00:28:10.147-07:00</updated><title type='text'>NoobOnRails is dead</title><content type='html'>So, in case you didn&#39;t know, I haven&#39;t been posting as much because of my full time Rails gig with &lt;a href=&quot;http://www.integrumtech.com/&quot;&gt;integrum&lt;/a&gt;. But, I decided to jump back into the blogging world but at a new address, &lt;a href=&quot;http://www.okwithfailure.com&quot;&gt;okwithfailure.com&lt;/a&gt;. I hope to be blogging there pretty consistently since I know have plenty to blog about. Hope to see you there!</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/6282601096334634288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/6282601096334634288' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/6282601096334634288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/6282601096334634288'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2007/04/noobonrails-is-dead.html' title='NoobOnRails is dead'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-6910439349209814910</id><published>2007-02-21T19:29:00.000-08:00</published><updated>2007-02-21T19:36:48.804-08:00</updated><title type='text'>Freezing to latest edge rails will break your app</title><content type='html'>But only for a brief second! The culprit? The switching of the default Rails session management method over to a cookie based management system. Right after I froze to edge, I started my app up and immediately tried to access it. Blam, it blew up in my face. Right there in the server console it was telling me I needed to stick &lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&lt;br /&gt;session :secret =&gt; &quot;secret phrase here&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;in my Application.rb. Doing that made everything better. You can read and dig into all what Jeremy added in this change set &lt;a href=&quot;http://dev.rubyonrails.org/changeset/6184&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/6910439349209814910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/6910439349209814910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/6910439349209814910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/6910439349209814910'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2007/02/freeze-to-laetst-edge-rails-could-break.html' title='Freezing to latest edge rails will break your app'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-155741298260374425</id><published>2007-02-21T14:21:00.000-08:00</published><updated>2007-02-21T16:11:49.769-08:00</updated><title type='text'>acts_as_list makes lists drop dead easy</title><content type='html'>Using ActiveRecord&#39;s acts_as_list makes dealing with listed items a breeze. A lot of the examples I have seen assume that you&#39;d be using acts_as_list on a parent&#39;s child items, the belongs_to side of a has_many relationship. Chances are, most of the time you&#39;ll be using acts_as_list, you&#39;ll be using it in the same situation but you can use it on a childless object as well. Here&#39;s the code...&lt;br /&gt;&lt;br /&gt;For this example, I&#39;ll go with a list of Books that I am displaying in a list, I have a Book.rb model and a Books controller and I&#39;m listing books in my Books &lt; style=&quot;font-weight: bold;&quot;&gt;script/generate add_position_to_books_table&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That creates the actual migration file. The insides of that file could look something like this...&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;class AddPositionToBook &lt;&gt;&lt;br /&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;def self.up&lt;/span&gt;&lt;br /&gt;   &lt;span style=&quot;font-weight: bold;&quot;&gt;add_column  :books, :position, :integer&lt;/span&gt;&lt;br /&gt;   #i didn&#39;t add a default becuase I&#39;m going to set one in the controller&lt;br /&gt;  &lt;br /&gt;   #if I currently had a list of books, I want to go through them and line them up&lt;br /&gt;   #so I need to reset the column information for the books table so that I can&lt;br /&gt;   #acutally use the position column in this same migration file&lt;br /&gt;   &lt;span style=&quot;font-weight: bold;&quot;&gt;Book.reset_column_information&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;   #have to grab all the books so I can cycle through them&lt;br /&gt;   &lt;span style=&quot;font-weight: bold;&quot;&gt;book = Books.find(:all)&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;   #iterate through the books and for each one, grab the actual book and it&#39;s&lt;br /&gt;   #position in the array so I can use their position to set their position, if&lt;br /&gt;   #that makes sense&lt;br /&gt;   &lt;span style=&quot;font-weight: bold;&quot;&gt;book.each_with_index do |b, i|&lt;/span&gt;&lt;br /&gt;     &lt;span style=&quot;font-weight: bold;&quot;&gt;b.position = i+1&lt;/span&gt;&lt;br /&gt;     #save it with the bang so it I did something naughty, it&#39;ll blow up on me&lt;br /&gt;     #it&#39;s not necessary b.save should work too&lt;br /&gt;     &lt;span style=&quot;font-weight: bold;&quot;&gt;b.save! &lt;/span&gt;&lt;br /&gt;   &lt;span style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;def self.down&lt;/span&gt;&lt;br /&gt;   #remove the column I just added because not every migration is perfect&lt;br /&gt;   &lt;span style=&quot;font-weight: bold;&quot;&gt;remove_column :books, :position&lt;/span&gt;&lt;br /&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Cool. Now we can &lt;span style=&quot;font-weight: bold;&quot;&gt;rake db:migrate&lt;/span&gt; from the command line to get the column in our database. Now we have the column, let&#39;s put it to work.&lt;br /&gt;&lt;br /&gt;In my Book.rb model, I can stick &lt;span style=&quot;font-weight: bold;&quot;&gt;acts_as_list&lt;/span&gt; near the top for readability. Something like...&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;class Book &lt;&gt;&lt;br /&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;acts_as_list&lt;/span&gt;&lt;br /&gt; #other stuffs like validations, spiffy methods etc&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;will work. Hot, we&#39;re so close...kind of. Now Let&#39;s look at the actual list view.&lt;br /&gt;&lt;br /&gt;In my view I&#39;m keeping things real simple. I just have all my books listed as s in one big table, nothing special. of course I have the table and th declarations above this but here...&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;% for book in @books %&gt;&lt;br /&gt; &amp;lt;tr&amp;gt;&lt;br /&gt;  &amp;lt;td&amp;gt;&lt;%=h book.title %&gt;&amp;lt;/td&amp;gt;&lt;br /&gt;  &amp;lt;td&amp;gt;&lt;%=h book.description&amp;lt;/td&amp;gt; &lt;br /&gt; &amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;% end %&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;...is where the real magic happens. Now let&#39;s throw our position goodies in there.&lt;br /&gt;&lt;br /&gt;In my view, maybe after my description &amp;lt;td&amp;gt, I can add a section for position. I would also have to add the corresponding &amp;lt;th&amp;gt header but I&#39;ll just show you the position row...&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&amp;lt;td&amp;gt&lt;%=h book.position %&gt; &amp;lt;/td&amp;gt&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Ok so the positions are now showing on the list. But if I think about it, I also need to add it to the form for when I add a new book. It would also be cool if I could also have it fill with what should be the last position. So let&#39;s add a field to the form for position and then move on to the controller. Here&#39;s the field in the form partial...&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;  &amp;lt;td&amp;gt;&lt;label for=&quot;book_position&quot;&gt;position&lt;/label&gt;&amp;lt;/td&amp;gt;&lt;br /&gt;  &amp;lt;td&amp;gt;&lt;%= text_field &#39;book&#39;, &#39;position&#39; %&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Cool. Now I have it in the form and I could submit a test one so I could see it create successfully in the server log. But I want it to already be filled in when I first get to the new book form. I want it to prefill with the last position number. I&#39;m picky like that. Here&#39;s how I made it happen...&lt;br /&gt;&lt;br /&gt;in the new method...&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  &lt;span style=&quot;font-weight:bold;&quot;&gt;def new&lt;br /&gt;&lt;br /&gt;    #grab all of the books so we know how many we have&lt;br /&gt;    b = Book.find(:all)&lt;br /&gt;    &lt;br /&gt;    #create a new book object because this is the new method&lt;br /&gt;    @book = Book.new&lt;br /&gt;    &lt;br /&gt;    #if we have less than one book, let&#39;s just set this position value to 1&lt;br /&gt;    if b.size &lt; 1&lt;br /&gt;      @book.position = 1&lt;br /&gt;    else&lt;br /&gt;      &lt;br /&gt;      #if we have more than one book, let&#39;s get the position of the last book&lt;br /&gt;      #and set this new book&#39;s position (in the form field at least), to &lt;br /&gt;      #1+ that value&lt;br /&gt;      @book.position = b.last.position+1&lt;br /&gt;    end&lt;br /&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now we move into the Create method to make sure our users don&#39;t try to put in crazy spaced out values. If my last book is at a position of 6, I don&#39;t want to be able to put in something with the position of 4535. So, in my &lt;span style=&quot;font-weight:bold;&quot;&gt;create&lt;/span&gt; method in my Book controller, I put this...&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;  def create&lt;br /&gt;    #first with grab the book params hash from the request sent in by the form&lt;br /&gt;    @book = Book.new(params[:book])&lt;br /&gt;&lt;br /&gt;    #get an array of all of the books just so I can find out how many I have&lt;br /&gt;    #this is probably would not be the best use of resources if I had &lt;br /&gt;    #millions of books, beats me&lt;br /&gt;    b = Book.find(:all)&lt;br /&gt;&lt;br /&gt;    if @book.save&lt;br /&gt;      #if the book is saved, let&#39;s check it&#39;s position against that array&lt;br /&gt;      #of books we just created&lt;br /&gt;      if @book.position &gt; b.last.position+2&lt;br /&gt;&lt;br /&gt;        #if the books position is greater than my last book in my list&lt;br /&gt;        #change it to fit right after the last one, for example&lt;br /&gt;        #if my last item has a position of 6, let&#39;s set this new one to &lt;br /&gt;        #a position of 7&lt;br /&gt;        @book.position = b.last.position+1&lt;br /&gt;      end&lt;br /&gt;      flash[:notice] = &#39;Your Book was successfully created.&#39;&lt;br /&gt;      redirect_to :action =&gt; &#39;list&#39;&lt;br /&gt;    else&lt;br /&gt;      render :action =&gt; &#39;new&#39;&lt;br /&gt;    end&lt;br /&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Cool. Now that&#39;s working. But currently, the only way to edit the position is to manually edit each book. We&#39;re better than that. Let&#39;s add some buttons to in the list view that will let us move the books up or down the list.&lt;br /&gt;&lt;br /&gt;In the list view, I turn this...&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&amp;lt;td&amp;gt&lt;%=h book.position %&gt; &amp;lt;/td&amp;gt&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;into this...&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;&amp;lt;td&amp;gt&lt;%=h book.position %&gt; &lt;br /&gt;&lt;br /&gt;&lt;% unless @book.first.position == book.position %&gt; &lt;br /&gt;&lt;br /&gt;        &lt;%= link_to &quot;up&quot;, { :action =&gt; &#39;move&#39;, :method =&gt; &#39;move_higher&#39;, :book_id =&gt; book.id } %&gt; &lt;br /&gt;        &lt;%= link_to &quot;top&quot;, { :action =&gt;&#39;move&#39;, :method =&gt; &#39;move_to_top&#39;, :book_id =&gt; book.id } %&gt; &lt;br /&gt;&lt;br /&gt;      &lt;% end %&gt; &lt;br /&gt;&lt;br /&gt;      &lt;% unless book.last? %&gt; &lt;br /&gt;&lt;br /&gt;        &lt;% unless book.position == (@books.first.position || @books.last.position) %&gt; | &lt;% end %&gt; &lt;br /&gt; &lt;br /&gt;      &lt;%= link_to &quot;down, { :action =&gt; &#39;move&#39;, :method =&gt; &#39;move_lower&#39;, :book_id =&gt; book.id } %&gt; &lt;br /&gt;      &lt;%= link_to &quot;bottom, { :action =&gt; &#39;move&#39;, :method =&gt; &#39;move_to_bottom&#39;, :book_id =&gt; book.id } %&gt; &lt;br /&gt;&lt;br /&gt;      &lt;% end %&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;/td&amp;gt&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Woah. Now what the heck is that doing right? If you want to know, either go grab &lt;a href=&quot;http://blog.tupleshop.com/&quot;&gt;Rob Orsini&lt;/a&gt;&#39;s &lt;a href=&quot;http://www.oreilly.com/catalog/9780596527310/&quot;&gt;Rails Cookbook&lt;/a&gt; from which I grabbed most of this code. The links, each one really, call the &#39;move&#39; method in our books controller as well as pass a method param which specifies which acts_as_list method we want that link to trigger. We also pass the book_id so our app knows which book to move. &quot;But there&#39;s no move method in the books controller!!&quot; I can hear you scream. Don&#39;t fret, here it is...&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;  &lt;br /&gt;  def move&lt;br /&gt;   &lt;br /&gt;    if [&quot;move_lower&quot;, &quot;move_higher&quot;, &quot;move_to_top&quot;, &quot;move_to_bottom&quot;].include?(params[:method]) and params[:book_id] =~ /^\d+$/&lt;br /&gt;     #if the incoming params contain any of these methods and a numeric book_id, &lt;br /&gt;     #let&#39;s find the book with that id and send it the acts_as_list specific method&lt;br /&gt;     #that rode in with the params from whatever link was clicked on&lt;br /&gt;      Book.find(params[:book_id]).send(params[:method])&lt;br /&gt;    end&lt;br /&gt;    #after we&#39;re done updating the position (which gets done in the background&lt;br /&gt;    #thanks to acts_as_list, let&#39;s just go back to the list page, &lt;br /&gt;    #refreshing the page basically because I didn&#39;t say this was an RJS&lt;br /&gt;    #tutorial, maybe next time&lt;br /&gt;    redirect_to :action =&gt; :list&lt;br /&gt;  end&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And that is it! Clicking on the up, top, down, bottom buttons on your list page will move the items up and down. If you need to tweak acts_as_taggable just a touch, mess with the scope or anything like that, check out what the rails edge docs have to say &lt;a href=&quot;http://caboo.se/doc/classes/ActiveRecord/Acts/List/ClassMethods.html#M006003&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/155741298260374425/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/155741298260374425' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/155741298260374425'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/155741298260374425'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2007/02/actsaslist-makes-lists-drop-dead-easy.html' title='acts_as_list makes lists drop dead easy'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-6304126435044286304</id><published>2007-02-21T10:35:00.000-08:00</published><updated>2007-02-21T10:42:20.416-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="deprecation"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby on rails"/><title type='text'>Goodbye .rhtml, we knew you well</title><content type='html'>So I hope you didn&#39;t have any emotional attachments to the .rhtml extension because accroding to the &lt;a href=&quot;http://dev.rubyonrails.org/changeset/6178&quot;&gt;recent changeset 6178&lt;/a&gt; it is on it&#39;s way out. Say goodbye to the the .rhtml and .rxml extensions  and hello the the .erb and .builder extensions. Why, you ask? as to make it a point that the extension shouldn&#39;t determine the content. Here&#39;s the message form the changelog...&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Added .erb and .builder as preferred aliases to the now deprecated .rhtml and .rxml extensions [Chad Fowler]. This is done to separate the renderer from the mime type. .erb templates are often used to render emails, atom, csv, whatever. So labeling them .rhtml doesn&#39;t make too much sense. The same goes for .rxml, which can be used to build everything from HTML to Atom to whatever. .rhtml and .rxml will continue to work until Rails 3.0, though. So this is a slow phasing out. All generators and examples will start using the new aliases, though.&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;So you don&#39;t have to completely stop using it right this very second today since you have until Rails 3 dot Oh to phase out the old extensions but it wouldn&#39;t hurt to start getting used to the new extensions.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/6304126435044286304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/6304126435044286304' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/6304126435044286304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/6304126435044286304'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2007/02/goodbye-rhtml-we-knew-you-well.html' title='Goodbye .rhtml, we knew you well'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-3411031438274955316</id><published>2007-01-30T20:00:00.000-08:00</published><updated>2007-01-30T20:08:52.203-08:00</updated><title type='text'>Microsoft Visual Studio goes red</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6Dx4r2QGxEhfg83CyHe6t2XI0FAuk26vMHzxEuwZ0X-WpM7jBxzw4C9BPdhAFikFiGT66JEJVq-weqvSXRxGTQ6ovc0Wv5k5kSJkmP0TlQFg_QOp6m8HHtXAL3OKdwUbZ_Izr/s1600-h/rubyinsteel.png&quot;&gt;&lt;img style=&quot;margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6Dx4r2QGxEhfg83CyHe6t2XI0FAuk26vMHzxEuwZ0X-WpM7jBxzw4C9BPdhAFikFiGT66JEJVq-weqvSXRxGTQ6ovc0Wv5k5kSJkmP0TlQFg_QOp6m8HHtXAL3OKdwUbZ_Izr/s320/rubyinsteel.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5026041684616055058&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Not the &quot;his filled red with rage&quot; kin fo red either. The Sapphire Steel Software chaps did it. &lt;span style=&quot;font-weight: bold;&quot;&gt;Ruby in Steel&lt;/span&gt; is now available for public consumption and lots of money. Ruby in Steel is a professional full blown Ruby IDE integrated into Microsoft&#39;s Visual Studio. If you hop on the Ruby in Steel bandwagon now, you can pick it up for the limited time price of $199. It will normally run for $249. For the $$$ adverse, there is a version you can download that doesn&#39;t have all of the whiz-bang features but it may be good enough.&lt;br /&gt;&lt;br /&gt;If you want to know what all you can do with it, check out the &lt;a href=&quot;http://www.sapphiresteel.com/spip.php?page=feature-list&quot;&gt;feature list&lt;/a&gt;. Woah, now that&#39;s a list.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/3411031438274955316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/3411031438274955316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/3411031438274955316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/3411031438274955316'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2007/01/microsoft-visual-studio-goes-red.html' title='Microsoft Visual Studio goes red'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6Dx4r2QGxEhfg83CyHe6t2XI0FAuk26vMHzxEuwZ0X-WpM7jBxzw4C9BPdhAFikFiGT66JEJVq-weqvSXRxGTQ6ovc0Wv5k5kSJkmP0TlQFg_QOp6m8HHtXAL3OKdwUbZ_Izr/s72-c/rubyinsteel.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-2933760709049844355</id><published>2007-01-30T15:26:00.000-08:00</published><updated>2007-01-30T15:50:39.847-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mac OS X"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby on rails"/><category scheme="http://www.blogger.com/atom/ns#" term="Tips"/><title type='text'>Helpful Mac OS X tips</title><content type='html'>Now that I&#39;ve joined a team of full on Railers who all develop on Macs, I&#39;ve had to jump in to the Mac OS X environment with both feet. After just staring at my Macbook for about a good 30 minutes when I first got it, I quickly had to adapt my old windows habits and shortcuts to my new Mac environment. This is mostly inspired by a recent post at &lt;a href=&quot;http://juixe.com/techknow/&quot;&gt;Juixe TechKnow&lt;/a&gt; about the Mac OS X F11 key. So here&#39;s my list, feel free to add on...&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;press F11&lt;/span&gt; - is like &quot;Show Desktop&quot; in Windows. It moves all windows out of the way. Pressing it again brings the windows back.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;press F12&lt;/span&gt; - Shows you your widgets(proper name?). I still have the defaults on mine which are the Calculator, Weather, Clock and Calendar.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;press F10&lt;/span&gt; - Tiles the windows of whatever program you have open. For example, if you have 4 FireFox windows open because you detest tabs, pressing F10 will tile them for you. &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;press F9&lt;/span&gt; - Tiles all of your non-minimized windows.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;press Apple+Shift+(Number 4)&lt;/span&gt; - All together - Changes your cursor into a little target looking icon which you can click and drag to create a screenshot of the area you selected. The screenshot gets saved to your desktop with a name like &quot;Picture 1.png&quot;. Awesome.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Terminal Tip&lt;/span&gt; - while in Terminal, you don&#39;t even have to fully type out your directory or file names. Just type the first few letters and hit tab and if that file is the only one with that name, it will fill it in for you. for example, if you&#39;re in the root of your rails app, my-awesome-computer:~/desktop/appz/rails4life and you type in &#39;scr&#39; and then hit the tab key, you get script. Then type &#39;se&#39; and hit tab and you get &#39;server&#39;. &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Textmate&lt;/span&gt; - Best text editor ever. My tip? Use it.&lt;br /&gt;&lt;br /&gt;So those are the tips I&#39;ve found handy so far. Anything else I should know about?</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/2933760709049844355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/2933760709049844355' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/2933760709049844355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/2933760709049844355'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2007/01/helpful-mac-os-x-tips.html' title='Helpful Mac OS X tips'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-7671994819884109351</id><published>2007-01-28T20:47:00.000-08:00</published><updated>2007-01-28T20:56:27.327-08:00</updated><title type='text'>Acts_as_taggable is no more!</title><content type='html'>We all knew it was bound to happen, but Evan Weaver made it official. Weaver has killed off acts_as_taggable. Not directly, but since no one is really doing much with the acts as taggable gem or plugin these days, they might as well be dead. But don&#39;t fret, Evan&#39;s has_many_polymorphs plugin will cure what ails you. He has up plenty of good examples of how to use his plugin on his site and even how to migrate your data and database structure from using acts_as_taggable to get them ready to use his plugin. I haven&#39;t used it yet, but it looks pretty solid.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://blog.evanweaver.com/articles/2006/06/02/has_many_polymorphs&quot;&gt;Here&#39;s the plug-in page&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/7671994819884109351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/7671994819884109351' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/7671994819884109351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/7671994819884109351'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2007/01/actsastaggable-is-no-more.html' title='Acts_as_taggable is no more!'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-4701193953918686565</id><published>2007-01-19T16:04:00.000-08:00</published><updated>2007-01-21T14:00:51.322-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="migrations"/><category scheme="http://www.blogger.com/atom/ns#" term="quirk"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby on rails"/><title type='text'>For the love of your Migrations, Reset your column info !</title><content type='html'>So a co-worker and I were hacking on migrations when one of them began to fail silently. It a migration we created to just add some data and not actually do anything structurally. The migration itself looked something like this...&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;code&quot;&gt;&lt;strong&gt;&lt;span&gt;&lt;span&gt;class IMINURDBMIGRATINGURDATAZ  &lt;&gt;&lt;span&gt;  def self.up&lt;/span&gt;&lt;br /&gt;&lt;span&gt;  fruits.each do |f|&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    a = Fruits.find_by_type(f[0])     &lt;/span&gt;&lt;br /&gt;&lt;span&gt;    a.smelliness = f[1]&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    a.save!&lt;/span&gt;&lt;br /&gt;&lt;span&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;span&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;  def self.down&lt;/span&gt;&lt;br /&gt;&lt;span&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;  def self.fruits&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        [[&#39;apple&#39;, &#39;like a flower&#39;],&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        [&#39;orange&#39;, &#39;like citrus heaven&#39;],&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        [&#39;kiwi&#39;, &#39;like sweet tarts in syrup&#39;],&lt;/span&gt;&lt;br /&gt;&lt;span&gt;        [&#39;onion&#39;, &#39;like how you would imagine death would smell&#39;]]&lt;/span&gt;&lt;br /&gt;&lt;span&gt;   end&lt;/span&gt;&lt;br /&gt;&lt;span&gt;end&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So what the up is doing is basically finding each fruit by type and setting the smelliness for each one. Looks good right? We thought so too. We ran it and it didn&#39;t work. So we popped into console (ruby/script console) and tried the exact same code there, it works. Hmm, that&#39;s odd. We blow all the tables away and try it again. No bueno. 45 minutes of head scratching and &quot;WTF!?!&quot; later and with the help of our boss, we figure out that it&#39;s because we kept running all of the migrations in succession. Because we were doing so and that a separate, previous migration was adding the smelliness table, we couldn&#39;t write to the smelliness column yet because we weren&#39;t reloading the column information from the object itself.&lt;br /&gt;&lt;br /&gt;So, we fixed it by adding&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span&gt;     Fruit.reset_column_information&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;right above our iteration in the up method, like so...&lt;br /&gt;&lt;br /&gt;&lt;span class =&quot;code&quot;&gt;&lt;strong&gt;&lt;span&gt;&lt;span&gt;class IMINURDBMIGRATINGURDATAZ  &lt;&gt;&lt;span&gt;  Fruit.reset_column_information&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;  def self.up&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    fruits.each do |f|&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    a = Fruits.find_by_type(f[0])     &lt;/span&gt;&lt;br /&gt;&lt;span&gt;    a.smelliness = f[1]&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    a.save!&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    end&lt;/span&gt;&lt;br /&gt;&lt;span&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;  def self.down&lt;/span&gt;&lt;br /&gt;&lt;span&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;  def self.fruits&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    [[&#39;apple&#39;, &#39;like a flower&#39;],&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    [&#39;orange&#39;, &#39;like citrus heaven&#39;],&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    [&#39;kiwi&#39;, &#39;like sweet tarts in syrup&#39;],&lt;/span&gt;&lt;br /&gt;&lt;span&gt;    [&#39;onion&#39;, &#39;like how you would imagine death would smell&#39;]]&lt;/span&gt;&lt;br /&gt;&lt;span&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;span&gt;end&lt;/span&gt; &lt;/strong&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I hope this saves someone else out there some time because it wasn&#39;t easy to find.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/4701193953918686565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/4701193953918686565' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/4701193953918686565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/4701193953918686565'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2007/01/for-love-of-your-migrations-reset-your.html' title='For the love of your Migrations, Reset your column info !'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115997363167034719</id><published>2006-10-04T07:43:00.000-07:00</published><updated>2006-10-18T07:37:31.366-07:00</updated><title type='text'>Becoming addicted to testing</title><content type='html'>If you&#39;re a follower of the faith of Extreme Programming, you probably already know this. If you&#39;re aspiring to convert to XP (extreme abbreviation for Extreme Programming) and want want to just be an all round better programmer, you need to build your tests. For me, it was hard getting used to this new methodology. I was just so used to self testing that after a while it became second nature. How did I overcome this nasty habit? With the oh so awesome &lt;a href=&quot;http://rubyforge.org/frs/?group_id=419&amp;release_id=7379&quot;&gt;ZenTest gem&lt;/a&gt; which canbe grabbed with the usual&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;gem install zentest&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;This gem contains some great libraries, of which you can &lt;a href=&quot;http://www.zenspider.com/ZSS/Products/ZenTest/&quot;&gt;read more about here&lt;/a&gt;. But the reason I wrote this post today is autotest.  Once you have the zentest installed, and if you&#39;re cool enough to be developing in a *nix environment, all you need to do is &lt;strong&gt;cd&lt;/strong&gt; into the root of your rails app and type in&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;autotest -rails&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;and you&#39;re off and running. If you developing in Windows, you&#39;ll get an error if you just try that right off the bat. The error will mention something about not knowing the HOME value so what we need to do is set it.  Still in your railsapp root directory, type in&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;set HOME=C:\path\to\your\rails\app&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;After you&#39;ve set Home, go ahead and fire up autotest with the &lt;strong&gt;autotest -rails&lt;/strong&gt; command and your console/DOS window will spring to life. It also wouldn&#39;t hurt to run this in the Test environment so you can also prepare your test db (you have one in your database.yml right?) with a little:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;rake db:test:prepare&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Now you have no reason NOT to be testing, especially with it being this easy. Enjoy :)&lt;strong&gt;&lt;br /&gt;&lt;/p&gt;&lt;/strong&gt;</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115997363167034719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115997363167034719' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115997363167034719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115997363167034719'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/10/becoming-addicted-to-testing.html' title='Becoming addicted to testing'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115973395799507368</id><published>2006-10-01T12:55:00.000-07:00</published><updated>2007-01-21T14:29:32.564-08:00</updated><title type='text'>Looking for Work [update]</title><content type='html'>I figured I&#39;d throw this out there to get some exposure and to let everyone know my status. I do have a full time job but I&#39;m currently looking for Ruby on Rails related work. I&#39;m taking all comers so if you&#39;re serious, I&#39;m currently up for discussion. Shoot me an e-mail via the &quot;e-mail me&quot; link to the right or you could even try to catch me on yahoo. If you want a peek at my resume, I&#39;m thinking about sticking it online somewhere or I can always e-mail it out.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;update&lt;/span&gt;: I&#39;m not looking anymore. I&#39;m currently and happily employed.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115973395799507368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115973395799507368' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115973395799507368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115973395799507368'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/10/looking-for-work.html' title='Looking for Work [update]'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115960341813693458</id><published>2006-09-30T00:49:00.000-07:00</published><updated>2006-09-30T01:06:58.446-07:00</updated><title type='text'>Using Rails to solve real world problems</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/2629/234/1600/mathcardsr0x0rz.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;http://photos1.blogger.com/blogger/2629/234/320/mathcardsr0x0rz.png&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;I am a strong believer in using what&#39;s available to right a wrong or to fix something that could be better. If you know how to use the tools, there&#39;s no reason what you can&#39;t make a change. With that introduction, I introduce the fruition of a few hours work...a little app I call mathcards (screenshot above). You know all that talk about solving real world problems? Well, for me, my problem was a lost my 6 yr old daughter&#39;s math cards. Ooops. Hard to raise a world dominator when you can even help her stay sharp in math. So I thought, &quot;flash cards are easy enough to mimic on a web site, why not build a site that can give her basically the same training?&quot;. Bam, a few hours later, there&#39;s mathcards. It&#39;s out and free for the world to use. Use it for your kids, use it because you&#39;re a rails newb who needs all the open source app they can get their hands on or just use to tinker with it and expand out the functionality. I remembered hearing about Google release some sort of sourceforge app so I figured this would be a good app to test it out on. The project&#39;s main site is &lt;a href=&quot;http://code.google.com/p/mathcards/&quot;&gt;here&lt;/a&gt; and the source information (including SVN info) is &lt;a href=&quot;http://code.google.com/p/mathcards/source&quot;&gt;here&lt;/a&gt;.  Check it out and if anyone is reading this, feel free to let me know what you think :)</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115960341813693458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115960341813693458' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115960341813693458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115960341813693458'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/09/using-rails-to-solve-real-world.html' title='Using Rails to solve real world problems'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115937280512254576</id><published>2006-09-27T08:54:00.000-07:00</published><updated>2006-10-03T21:23:48.956-07:00</updated><title type='text'>Good SEO mojo with Rails</title><content type='html'>So you&#39;ve created your site that allows you to sell all the cool desinger knitted sweaters you&#39;ve made over the past few weeks and you&#39;ve just stuck your site online. Five months later, no one has visited your site outside of you and grandma and she didn&#39;t even buy anything. Cheapskate. At this point you realize, to make it big, you have to get some decent ranking on the big search engines.&lt;br /&gt;&lt;br /&gt;Now, I&#39;m not going to even pretend like I&#39;m MR. SEO or anything but I&#39;m going to post a few tips that I believe can help, not harm, your page ranking and hopefully give you somewhere to start from. I&#39;ll start with three tips, if you can think of anything else, please, feel free to comment below. If you have any requests, put&#39;em up. I can&#39;t guarantee I can fulfill them but at least there&#39;s a chance it&#39;ll spark some interest or conversation. So, here are three basic Ruby on Rails SEO tips:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. WWW or no WWW&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Without any configuration on your server or routes, your website can be accessed two ways, &lt;strong&gt;http://yoursite.com&lt;/strong&gt; and &lt;strong&gt;http://www.yoursite.com&lt;/strong&gt;. Seems harmless but the problem with this is, or so I&#39;ve heard, that some search engines may consider them as two seperate sites and think that you&#39;re duplicating your content, as a means to try and trick them. They tend to frown on this so the quicker you can avoid this, the better.&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;UPDATE&lt;/span&gt;: As the anonymous posted below pointed out, the matt cutts article I had in mind when writing this, doesn&#39;t necessarily take this stance. He states that you should basically use redirects as a means to point the search engine&#39;s crawlers to the right content. I could&#39;ve sworn I heard the double content idea from somebody though. Oh well, false alarm. &lt;br /&gt; &lt;br /&gt;I believe the best and most effective way to handle this is at the web server level and for me, I&#39;m currently using Mongrel to host my &lt;a href=&quot;http://cookmor.com&quot;&gt;cookmor&lt;/a&gt; site (no www&#39;s in that link, click it and watch it redirect) so this is how I did this redirect for Mongrel: You first need to create a mongrel.conf file to throw this code in (you&#39;ll call it when you start Mongrel, you&#39;ll see later) so create a mongrel.conf file and stick it in your railsapp/log/ folder. This goes in the mongrel.conf file:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;class RedirectHost &lt;&gt;&lt;br /&gt;&lt;br /&gt;def process(request, response)&lt;br /&gt;if request.params[&quot;HTTP_X_FORWARDED_HOST&quot;] == &quot;yoursite.com&quot;&lt;br /&gt;response.start(302,true) do head, body&lt;br /&gt;head[&quot;Location&quot;] = &quot;http://www.yoursite.com/&quot;&lt;br /&gt;head[&quot;Content-type&quot;] = &quot;text/html&quot;&lt;br /&gt;body.write(&quot;Please go here instead: &lt;a style=&quot;FONT-WEIGHT: bold&quot; href=&quot;http://noobonrails.blogspot.com/&quot;&gt;http://noobonrails.blogspot.com/&lt;/a&gt;&quot;)&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;uri &quot;/&quot;, :handler =&gt; RedirectHost.new, :in_front =&gt; true&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Once that file is created and saved, stop mongrel. Restart it by using this statement:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;mongrel_rails start -e production -p YOURDESIREDPORT -d -S log/mongrel.conf&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Booyah. Now chances are you may not be using only mongrel to host your site, and that&#39;s ok, so to compensate, &lt;a href=&quot;http://www.cyberciti.biz/tips/lighttpd-redirect-www-domaincom-to-domain-com.html&quot;&gt;here&#39;s how you do it with lighttpd&lt;/a&gt;, &lt;a href=&quot;http://www.mcanerin.com/EN/articles/301-redirect-apache.asp&quot;&gt;here&#39;s how you do it with Apache&lt;/a&gt; and even &lt;a href=&quot;http://www.litespeedtech.com/support/forum/showthread.php?t=586&amp;amp;highlight=redirect&quot;&gt;how to do it with LightSpeed&lt;/a&gt;. That&#39;s all I could think of.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Prettier URLs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This really depends on how you define pretty. If you define pretty as http://www.yourbooks.com/books/show/rails-is-fer-heroes, then you&#39;re ok. If not, you&#39;re will be getting nothing but tumbleweeds my friend. The whole thinking here is that, if the urls are easier for the search engines to read and understand, it will be easier for them to match up keywords to the proper pages on your site. Just don&#39;t try to fit too many keywords in your url, I&#39;m sure /show/credit_reporting_for_credit_reporters_reporting_on_credit will look a little suspicious.&lt;br /&gt;&lt;br /&gt;So, say you have a book website on which you list your books. You also have a show action in your controller that is called whenever you want to show the details of a certain book. Currently, the url on your show book page looks something like this, http://www.mybooksrox.com/books/show/422. Now that&#39;s all fine and dandy but we can do better for Google. Let&#39;s create a &quot;named route&quot; in your config/routes.rb file (more on routes &lt;a href=&quot;http://wiki.rubyonrails.org/rails/pages/Routes&quot;&gt;here&lt;/a&gt;). So above the&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;map.connect &#39;:controller/:action/:id&#39;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;that is the defacto standard route that all routes.rb contain at the onset, stick this route:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;map.book &#39;books/:booktitle&#39;, :controller =&gt; &#39;books&#39;, :action =&gt; &#39;show&#39;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;What this is doing is telling rails to generate a URL of books/whateverbooktitleis when invoked from the books controller and show action. Where do we define booktitle? Where ever we make a call to show a recipe, like this:&lt;br /&gt;&lt;br /&gt;&amp;lt;% for book in @books%&amp;gt;&lt;strong&gt;&amp;lt;li&amp;gt;* %lt;%= link_to book.title, book_url(:booktitle =&gt; book.title) %&amp;gt;&amp;lt;/li&amp;gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;% end -%&amp;gt;&lt;br /&gt;This does assume that you have a title column in your books table. book_url is actually calling the named route we created and we&#39;re passing the booktitle param along with it. Save your files and on whatever page you created those links on, they should now point to a url which includes the book titles.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. Google Sitemaps&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now that I&#39;ve typed this much, I can&#39;t really rememebr what number 3 was supposed to be... oh well. The next tip I could think of is to use Google Sitemaps for your site so that Google can easily serach and index it. There&#39;s a good, basic article &lt;a href=&quot;http://www.codeism.com/archive/show/578&quot;&gt;here&lt;/a&gt; that seems just fine. For mre information on Google sitemaps and why they&#39;re the bees kness, check out their site &lt;a href=&quot;https://www.google.com/webmasters/sitemaps/docs/en/about.html&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;That&#39;s all I could think of for now. If I missed anything, please let me know. Happy coding.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115937280512254576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115937280512254576' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115937280512254576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115937280512254576'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/09/good-seo-mojo-with-rails.html' title='Good SEO mojo with Rails'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115915888370806170</id><published>2006-09-24T21:14:00.000-07:00</published><updated>2006-11-30T04:00:02.790-08:00</updated><title type='text'>How to make a Dynamic Sortable List</title><content type='html'>This one was a but tricky for my noobish rails mind but once I found the solution, it made a lot of sense. Basically, I had this list of items that I needed to be sortable. The problem was, the use could change the contents of this list via an RJS-friendly selection list. When the user did make a change, the list wouldn&#39;t be sortable anymore.    Why wasn&#39;t it sortable anymore you ask? Because my rjs template was only replacing the list container, to showcase the new contents, and not the actual JavaScript that rendered the list sortable. Here&#39;s what my selection list looked like:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;%= form_remote_tag :url =&gt; {:action =&gt; &quot;get_list&quot;, :id =&gt; @days_out},&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;                    :html =&gt; {:id =&gt; &quot;shopping_list&quot;} %&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;%= select(&quot;dinner&quot;, &quot;days_out&quot;, %w{1 2 3 4 5 6 7}, { :include_blank =&gt; true })%&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;%= submit_tag &quot;Get List&quot; %&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;%= end_form_tag %&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and my shopping list container looked like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;ul id=&quot;shop_list&quot; class=&quot;list&quot; style=&quot;list-style-type: none; list-style-image: none; list-style-position: outside;&quot;&gt;  &lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;and here&#39;s the scriptaculous code that makes my list sortable:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;div id=&quot;sort&quot;&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;%= render :partial =&gt; &#39;sort&#39;%&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;(the sort partial):&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;%= sortable_element &#39;shop_list&#39;,  &lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;      :complete =&gt; visual_effect(:highlight, &#39;shop_list&#39;), &lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;      :url =&gt; { :action =&gt; &quot;order&quot; } %&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;So I had my selection list form, my list of sortable items and the code to make my list sortable. What does the dynamic updating? Why my RJS template of course. Here&#39;s the get_list action in my controller:&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;  def get_list&lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;    @days_out = params[:dinner][:days_out]&lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;    &lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;    @recipes = Dinner.find(:all, &lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;                           :conditions =&gt; [&quot;dinner_night between ? and ?&quot;, Date.today, Date.today+(@days_out.to_i)], &lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;                           :include =&gt; :recipe).map {|r| r.recipe.ingredients}&lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;    Dinner.parse(@recipes)&lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;  end&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;I grab the values that were passed by the form and stick them into the @days_out instance variable. Then I use that value to determine which ingredients I need to populate my selection list with. That &quot;Dinner.parse(@recipes)&quot; just cleans up the ingredients so the user gets a basic list, uncluttered by the (what I&#39;ve deemed) unnecessary.&lt;br /&gt;&lt;br /&gt;Here&#39;s the get_list.rjs template:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;page.replace_html &#39;shop_list&#39;, :partial =&gt; &#39;item&#39;&lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;page.replace_html &#39;sort&#39;, :partial =&gt; &#39;sort&#39;&lt;/span&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;page.visual_effect :highlight, &#39;shop_list&#39;, :duration =&gt; 1&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;As you can see in the rjs template, I first replace the shopping list partial, then I replace the scriptaculous code and then I wrap it up by yellow-fading the whole list. Purty ain&#39;t it? &lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115915888370806170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115915888370806170' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115915888370806170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115915888370806170'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/09/how-to-make-dynamic-sortable-list.html' title='How to make a Dynamic Sortable List'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115854836582420186</id><published>2006-09-17T19:51:00.000-07:00</published><updated>2006-09-17T20:00:16.323-07:00</updated><title type='text'>Railsconf Europe</title><content type='html'>Sounds like Rails conf Europe was a good couple of days. A few blogs out there have a good coverage of waht went down, but &lt;a href=&quot;http://www.xml-blog.com/&quot;&gt;Xml blog&lt;/a&gt; and the &lt;a href=&quot;http://copenhagenrb.dk/&quot;&gt;Copenhagen Ruby Brigade&lt;/a&gt; seem to have most of the bases covered as far as content goes. &lt;a href=&quot;http://www.flickr.com/photos/tags/railsconfeurope&quot;&gt;By the look of the flickr photos&lt;/a&gt;, it looks like everyone had a good time.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115854836582420186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115854836582420186' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115854836582420186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115854836582420186'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/09/railsconf-europe.html' title='Railsconf Europe'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115781898061990712</id><published>2006-09-09T09:19:00.000-07:00</published><updated>2006-09-09T12:37:05.140-07:00</updated><title type='text'>All the bests Rake tasks</title><content type='html'>I just came across (just as in the day before yesterday) &lt;a href=&quot;http://idiotis.ms/6/rails+rake+tasks&quot;&gt;a site&lt;/a&gt; that has a list of all (as far as I know) of &lt;a href=&quot;http://idiotis.ms/6/rails+rake+tasks&quot;&gt;the possible rake tasks you can run in the context of your Rails application&lt;/a&gt;. From the old fav &lt;span style=&quot;font-weight:bold;&quot;&gt;rake db:schema:dump&lt;/span&gt; to the new cool &lt;span style=&quot;font-weight:bold;&quot;&gt;rake db:sessions:clear&lt;/span&gt; and even the classic &lt;span style=&quot;font-weight:bold;&quot;&gt;rake rails:freeze:edge&lt;/span&gt;. Good resource.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;UPDATE: the main site, &lt;a href=&quot;http://idiotis.ms/&quot;&gt;http://idiotis.ms/&lt;/a&gt;, has a lot of cheatsheets for other commands as well, like gem and capistrano.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115781898061990712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115781898061990712' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115781898061990712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115781898061990712'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/09/all-bests-rake-tasks.html' title='All the bests Rake tasks'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115722566792456611</id><published>2006-09-02T12:32:00.000-07:00</published><updated>2006-09-02T14:23:50.570-07:00</updated><title type='text'>error: Association named ...... was not found</title><content type='html'>After totally reworking one of my apps (have to gut it since I&#39;m changing it&#39;s focus), I botted up mongrel, expecting to see everything was hunky dory and working great. I browsed to one of my list actions and I got this error:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Association named &#39;user&#39; was not found; perhaps you misspelled it?&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Hmmm. I know that&#39;s how you spell user so I knew that wasn&#39;t the problem. What the problem ended up being was I was trying to eagerly load this object&#39;s users with a  :include =&gt; &#39;user&#39;. This worked in the past because this object&#39;s table had a user_id column in it. But, due to me reworking it, it no longer did. So to sum how I resolved this errror, I just removed the &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;, :include =&gt; &#39;user&#39;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;and it worked fine.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115722566792456611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115722566792456611' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115722566792456611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115722566792456611'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/09/error-association-named-was-not-found.html' title='error: Association named ...... was not found'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115688314257972761</id><published>2006-08-29T13:25:00.000-07:00</published><updated>2006-11-20T21:12:47.953-08:00</updated><title type='text'>Adding user support to the acts_as_taggable plugin</title><content type='html'>&lt;P&gt;I was going to write this huge post on how to do this but it looks like I don&#39;t need to. &lt;A title=&quot;adding user support to acts_as_taggable&quot; href=&quot;http://www.slashdotdash.net/blog/articles/2006/04/29/acts_as_taggable-per-user-tagging&quot;&gt;SlashDotDash&lt;/A&gt;  has a post up on how to add user support to acts_as_taggable and it looks mighty fine to me so instead of duplicating efforts...&lt;A title=&quot;how to add support for users to acts_as_taggable&quot; href=&quot;http://www.slashdotdash.net/blog/articles/2006/04/29/acts_as_taggable-per-user-tagging&quot;&gt;go here!&lt;/A&gt;  The problem with this is that when a user edits the tags, they could potentially delete all of the tags for that item. I could work on a fix for this unless someone else has one they can post?&lt;/P&gt; &lt;P&gt; &lt;/P&gt;</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115688314257972761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115688314257972761' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115688314257972761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115688314257972761'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/08/adding-user-support-to-actsastaggable.html' title='Adding user support to the acts_as_taggable plugin'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115679355756385988</id><published>2006-08-28T12:22:00.000-07:00</published><updated>2006-08-28T14:28:57.000-07:00</updated><title type='text'>Best Rails editor for the pc</title><content type='html'>I just wanted to put this post up because these guys don&#39;t seem to get too much love in the community and I think they deserve some more. RadRails has, in my experience, been the best development environment to use when building Rails sites in a Windows environment. Why do I like it so? Besides the obvious organizational benefits that come from migrating from Notepad, I can easily configure it to run either a mongrel or webrick server (I haven&#39;t tried lightty on Windows), plus I can easily switch my perspective over to a view of my database or a view of my SNV repository (amongst others) and with the SVN tools being, I can just keep better track of changes. For me, it&#39;s just awsome. That could have something to do with me being relatively new to the whole IDE-ish world of development but I know what I likes, and I likes me some RadRails. &lt;br /&gt;&lt;br /&gt;Are there any other notable IDE/editors that are Rails friendly that I should try? The ones I&#39;ve seen don&#39;t compare feature wise to RadRails just yet.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115679355756385988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115679355756385988' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115679355756385988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115679355756385988'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/08/best-rails-editor-for-pc.html' title='Best Rails editor for the pc'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115679231490906858</id><published>2006-08-28T12:00:00.000-07:00</published><updated>2006-08-28T12:12:51.076-07:00</updated><title type='text'>Acts as Taggable gem springs back to life</title><content type='html'>Apparently Obie Fernandez is caught up writing a book so &lt;a href=&quot;http://jroller.com/page/obie?entry=acts_as_taggable_beta_release&quot;&gt;he passed the acts_as_taggable gem hat on&lt;/a&gt; to &lt;a href=&quot;http://www.economysizegeek.com/&quot;&gt;Dirk Elmendorf&lt;/a&gt;. He&#39;s already &lt;a href=&quot;http://rubyforge.org/projects/taggable/&quot;&gt;applied some useful changes and even made the gem safer to use&lt;/a&gt; (preveted SQL injection attacks). I have an acts_as_taggable plugin article cooking but now I&#39;m thinking I may switch it over to the gem instead of the plugin. I&#39;m not sure though, I&#39;ll tinker with it and whatever seems more benefical I&#39;ll use. Either way, it&#39;s good to see this project get picked back up again.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115679231490906858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115679231490906858' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115679231490906858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115679231490906858'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/08/acts-as-taggable-gem-springs-back-to.html' title='Acts as Taggable gem springs back to life'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115622659517926387</id><published>2006-08-21T22:49:00.000-07:00</published><updated>2006-08-21T23:08:45.990-07:00</updated><title type='text'>Redirecting with Mongrel</title><content type='html'>This took me a minute to figure but with the great folks at &lt;a href=&quot;http://www.lingr.com/room/3yXhqKbfPy8#&quot;&gt;Mongrel support&lt;/a&gt; (ie Zed), it was a piece of cake. This is the script I stuck in a file called, mongrel.conf in my railsapp/log folder on my production server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class RedirectHost &lt; Mongrel::HttpHandler&lt;br /&gt;&lt;br /&gt;  def process(request, response)&lt;br /&gt;    if request.params[&quot;HTTP_X_FORWARDED_HOST&quot;] == &quot;DOMAIN.com&quot;&lt;br /&gt;      response.start(302,true) do |head, body|&lt;br /&gt;        head[&quot;Location&quot;] = &quot;http://www.DOMAIN.com/&quot;&lt;br /&gt;        head[&quot;Content-type&quot;] = &quot;text/html&quot;&lt;br /&gt;        body.write(&quot;Please go here instead: &lt;a href=&quot;&#39;http://www.DOMAIN.com&#39;&quot;&gt;www.DOMAIN.com&lt;/a&gt;&quot;)&lt;br /&gt;     &lt;br /&gt;      end&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;uri &quot;/&quot;, :handler =&gt; RedirectHost.new, :in_front =&gt; true&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What this script is basically saying is that if the incoming HTTP request begins with just &quot;domain.com&quot;, redirect it to &quot;http://www.domain.com&quot;.  In my if statement, I had to use  request.params[&quot;HTTP_X_FORWARDED_HOST&quot;] becuase I&#39;m on a shared host which puts me behind a proxy. If you try this script and it&#39;s not working, stick&lt;br /&gt;&lt;br /&gt;puts request.params.inspect&lt;br /&gt;&lt;br /&gt;under the body.write line and above that first end, save it, stick it on your server, restart mongrel&lt;br /&gt;and try hitting your site again. It still won&#39;t work, but you&#39;ll get some more information in your&lt;br /&gt;mongrel.log file. From that extra info, you should be able to see if you need to use&lt;br /&gt;&quot;HTTP_X_FORWARDED_HOST&quot; or just &quot;Host&quot;. You can see my redirecting in action over at &lt;a href=&quot;http://cookmor.com&quot;&gt;http://cookmor.com&lt;/a&gt;&lt;br /&gt;(that&#39;ll redirect to http://www.cookmor.com)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;UPDATE: I thought i would mention how you start mongrel to load that script. The mongrel.conf sits in your railsapp/log folder so, from your RailsApp folder, start mongrel with with this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;mongrel_rails start -e production -p YOURDESIREDPORT -d -S log/mongrel.conf&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115622659517926387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115622659517926387' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115622659517926387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115622659517926387'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/08/redirecting-with-mongrel.html' title='Redirecting with Mongrel'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115434160624539281</id><published>2006-07-31T03:23:00.000-07:00</published><updated>2006-07-31T03:26:46.246-07:00</updated><title type='text'>Introducing Cookmor</title><content type='html'>The RoR project I&#39;ve been hacking away on, little by little for the past few months was just released into the wild. I&#39;ve dubbed it &lt;a href=&quot;http://www.cookmor.com&quot;&gt;Cookmor&lt;/a&gt; and it can be found at &lt;a href=&quot;http://www.cookmor.com&quot;&gt;http://www.cookmor.com&lt;/a&gt;. It&#39;s a bit feature sparse at the moment but I my main plan of attack was to release it and not feature pack it from the onset. Now that it&#39;s released, I&#39;ll see how the audience (if it ever finds one ;) responds and where they want to take the site. But for now, enjoy the simplicity!</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115434160624539281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115434160624539281' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115434160624539281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115434160624539281'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/07/introducing-cookmor.html' title='Introducing Cookmor'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115434140443551343</id><published>2006-07-31T03:19:00.000-07:00</published><updated>2006-07-31T03:23:24.446-07:00</updated><title type='text'>What I&#39;ve been busy with...</title><content type='html'>There&#39;s two reasons a I didn&#39;t do the aforementioned acts_as_taggable post yet.&lt;br /&gt;&lt;br /&gt;1. There&#39;s a pretty good post here:&lt;br /&gt;&lt;br /&gt;http://www.juixe.com/techknow/index.php/2006/07/15/acts-as-taggable-tag-cloud/&lt;br /&gt;&lt;br /&gt;and here:&lt;br /&gt;&lt;br /&gt;http://www.juixe.com/techknow/index.php/2006/07/18/acts-as-taggable-conditions-hack/&lt;br /&gt;&lt;br /&gt;and 2. I&#39;ve been working on releasing my app! I&#39;ll properly intorduce it in my next post.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115434140443551343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115434140443551343' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115434140443551343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115434140443551343'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/07/what-ive-been-busy-with.html' title='What I&#39;ve been busy with...'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115094992238694131</id><published>2006-06-21T21:17:00.000-07:00</published><updated>2006-07-23T02:04:16.846-07:00</updated><title type='text'>Coming soon: the things you can do with the acts_as_taggable plugin</title><content type='html'>I saw that some more changes have been made to the acts_as_taggable plugin so I figured I give everyone a head&#39;s up that I&#39;ll be putting up a how to post within the next few days...</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115094992238694131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115094992238694131' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115094992238694131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115094992238694131'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/06/coming-soon-things-you-can-do-with.html' title='Coming soon: the things you can do with the acts_as_taggable plugin'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115086420471867814</id><published>2006-06-20T20:43:00.000-07:00</published><updated>2006-06-21T06:44:19.070-07:00</updated><title type='text'>How to setup Mongrel as a native Window&#39;s service</title><content type='html'>Being that I have to do my Ruby on Rails development in a Windows environment, I jumped at the chance to use the impressive, somewhat-new, lil web server that could Mongrel. I thought it was pretty cool that you could run it as a Windows service. &quot;mongrel_rails start&quot; is just way too much for me to type...seriously, it&#39;s like I type &quot;mongrel_rai...what was I doing again?&quot;. Adult ADD is real and here to stay people. All semi-kidding aside, here&#39;s how to go from zero to mongrel hero in as fast as it takes you to type these next steps:&lt;br /&gt;&lt;br /&gt;1. From a command prompt type in &lt;br /&gt;&lt;br /&gt;&quot;gem install mongrel&quot; and hit enter...&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/2629/234/1600/mongrel1.gif&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;http://photos1.blogger.com/blogger/2629/234/320/mongrel1.gif&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;...you&#39;ll get a whole slew of versions to install and that&#39;s normal. Right now, 3.13 for mswin32 is out and that should be #1 so pick that one. &lt;br /&gt;&lt;br /&gt;2. After mongrel is installed, test it to make sure you&#39;re good to go. &quot;cd&quot; into your application&#39;s directory and type in &quot;mongrel_rails start&quot; to make sure Mongrel boots up as it should...&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/2629/234/1600/mongrel2.gif&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;http://photos1.blogger.com/blogger/2629/234/320/mongrel2.gif&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3. If it looks all good and sorted, you&#39;ll need to install the win32-service gem, via  &quot;gem install win32-service&quot; (pick the most recent one...)&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/2629/234/1600/mongrel3.gif&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;http://photos1.blogger.com/blogger/2629/234/320/mongrel3.gif&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. Sweet, now install the mongrel_service gem...i&#39;m sure you know the drill by now, it&#39;s &lt;br /&gt;&lt;br /&gt;gem install mongrel_service&lt;br /&gt;&lt;br /&gt;(no screenshots for this step because i&#39;m lazy)&lt;br /&gt;&lt;br /&gt;5. Now for the good stuff, actually creating the service... &lt;br /&gt;&lt;br /&gt;&quot;mongrel_rails service::install -N MyAppsServiceName -c c:\app\myapp -p 4000 -e production&quot;&lt;br /&gt;&lt;br /&gt;I&#39;m sure you can guess the params, but for the sake of completeness I&#39;ll go through what they mean. The-N MyAppsServiceName is what the service will be called, -p is the port number it&#39;ll run through (you&#39;ll probably want to change it if you have multiple apps on your box) and -e is the &quot;mode&quot; you want your app to run in.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/2629/234/1600/mongrel4.0.gif&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;http://photos1.blogger.com/blogger/2629/234/320/mongrel4.0.gif&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;6.  Bam! Now you should be good to go...&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/2629/234/1600/mongrel5.gif&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;http://photos1.blogger.com/blogger/2629/234/320/mongrel5.gif&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115086420471867814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115086420471867814' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115086420471867814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115086420471867814'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/06/how-to-setup-mongrel-as-native-windows.html' title='How to setup Mongrel as a native Window&#39;s service'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19115874.post-115086132279983179</id><published>2006-06-20T20:29:00.000-07:00</published><updated>2006-06-20T20:42:02.816-07:00</updated><title type='text'>A neat little feature of Ror 1.1+ I&#39;ve noticed</title><content type='html'>If you&#39;re really new to rails you may have thought this was normal but with myself being a Railer pre version 1.0, it took me a while to see that Rails was doing this on purpose. What is &quot;this&quot; you ask? The fact that now when you script generate a new model, a new migration file for the new model also gets created. &lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;http://photos1.blogger.com/blogger/2629/234/1600/script.gif&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;&quot; src=&quot;http://photos1.blogger.com/blogger/2629/234/320/script.gif&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That&#39;s dang spiffy if you ask me but if did give me some brief grief (ha!) since I had alreay added &quot;creat_tables&quot; in my base migration file for these models. Now I know to just go with the Rails flow. More &quot;convention over configuration&quot; is always good to me.</content><link rel='replies' type='application/atom+xml' href='http://noobonrails.blogspot.com/feeds/115086132279983179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/19115874/115086132279983179' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115086132279983179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19115874/posts/default/115086132279983179'/><link rel='alternate' type='text/html' href='http://noobonrails.blogspot.com/2006/06/neat-little-feature-of-ror-11-ive.html' title='A neat little feature of Ror 1.1+ I&#39;ve noticed'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>