<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" 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" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CUUBQH07fip7ImA9WhVRE0w.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853</id><updated>2012-03-21T00:00:51.306-07:00</updated><category term="BitNami" /><category term="MySQL" /><category term="Droid" /><category term="autotest" /><category term="fonts" /><category term="Rookie on Rails" /><category term="Windows" /><category term="SQLite" /><category term="scaffold" /><category term="restful_authentication" /><category term="Hello World" /><category term="STI" /><category term="Single Table Inheritance" /><category term="editor" /><category term="Railscasts" /><category term="E-TextEditor" /><category term="gem" /><category term="functional testing" /><category term="RoRED" /><category term="Rookie" /><category term="TextMate" /><category term="RoR" /><category term="OOP" /><category term="Notepad++" /><category term="InstantRails" /><category term="polymorphism" /><category term="Rails 2.0" /><category term="edit_polymorphic_path" /><category term="testing" /><category term="Ruby on Rails" /><category term="rake" /><category term="ZenTest" /><title>Rookie on Rails</title><subtitle type="html">Ruby on Rails from scratch</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://rookieonrails.blogspot.com/" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/RookieOnRails" /><feedburner:info uri="rookieonrails" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DkMFSHw4fCp7ImA9WxZSEEo.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-5698332754254323925</id><published>2008-01-21T12:55:00.000-08:00</published><updated>2008-01-22T23:46:59.234-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-22T23:46:59.234-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Single Table Inheritance" /><category scheme="http://www.blogger.com/atom/ns#" term="polymorphism" /><category scheme="http://www.blogger.com/atom/ns#" term="edit_polymorphic_path" /><category scheme="http://www.blogger.com/atom/ns#" term="STI" /><title>STI Views Revisited or Polymorphic Paths</title><content type="html">In my &lt;a href="http://rookieonrails.blogspot.com/2008/01/sti-experiments-scaffolded-sti-sub.html"&gt;previous post&lt;/a&gt; I lamented the strange and inconsistent behavior of the the automatically generated view for a simple STI hierarchy. After many searches and several futile attempts to explain myself on the #rubyonrails IRC chat, I &lt;a href="http://groups.google.com/group/rubyonrails-core/browse_frm/thread/ab261dc35b74f238"&gt;posted my question&lt;/a&gt; (slightly simplified) to the &lt;a class="ln" href="http://groups.google.com/group/rubyonrails-core"&gt;Ruby on Rails: Core&lt;/a&gt; list.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mislav.caboo.se/"&gt;Mislav Marohnić&lt;/a&gt; was kind enough to shed light on my problem. He &lt;a href="http://groups.google.com/group/rubyonrails-core/msg/c2aed965a04422cc"&gt;said&lt;/a&gt; (edited for context):&lt;br /&gt;&lt;blockquote style="font-style: italic;"&gt;When you say link_to(text, record), a polymorphic url is constructed depending on the model. But when you say edit_parent_path, you are explicitly stating that you are dealing with Parent records and that no polymorphism should take place.&lt;br /&gt;&lt;br /&gt;I understand that when using STI you have a need for a polymorphic helper, but I don't think changing the behavior of named routes (explicit or automatically generated) is a solution - it would just be the source of more confusion for others.&lt;br /&gt;&lt;br /&gt;Your cup of tea would be the edit_polymorphic_path helper...&lt;/blockquote&gt;Essentially, I just need to change:&lt;br /&gt;&lt;pre&gt;link_to 'Edit', &lt;span style="font-weight: bold;"&gt;edit_parent_path(parent)&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;to&lt;pre&gt;link_to 'Edit', &lt;span style="font-weight: bold;"&gt;edit_polymorphic_path(parent)&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt; and &lt;code&gt;&lt;span style="font-weight: bold;"&gt;edit_polymorphic_path()&lt;/span&gt;&lt;/code&gt; will do the correct thing and generate the path based on the concrete record type.&lt;br /&gt;&lt;br /&gt;Problem solved! Thank you Mislav!&lt;br /&gt;&lt;br /&gt;On a side note,  &lt;code&gt;&lt;span&gt;edit_polymorphic_path()&lt;/span&gt;&lt;/code&gt; used to be part of the &lt;a href="http://agilewebdevelopment.com/plugins/simply_helpful"&gt;simply_helpful plugin&lt;/a&gt;, but had been merged into core Rails more than 8 months ago. However it had not been documented, and my post seems to have &lt;a href="http://groups.google.com/group/rubyonrails-core/browse_frm/thread/b5b3cbbec71c6e9b"&gt;sparked the documentation and exposure of this module and its kin&lt;/a&gt;. Excellent! My minor and indirect contribution to Rails. ... &lt;span style="font-style: italic;"&gt;and&lt;/span&gt;, you won't read this in &lt;span style="font-style: italic;"&gt;any&lt;/span&gt; Rails book!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;If you found this post helpful, or you have more thought on this subject, please leave a message in the comments. If you want to read more about my exploration of &lt;a href="http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming"&gt;polymorphism&lt;/a&gt; and STI on Rails, subscribe to the &lt;a href="http://rookieonrails.blogspot.com/feeds/posts/default"&gt;blog feed&lt;/a&gt; and stay updated.&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/6Yx8P9PSXck" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/5698332754254323925/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=5698332754254323925" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/5698332754254323925?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/5698332754254323925?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/6Yx8P9PSXck/sti-views-revisited-or-polymorphic.html" title="STI Views Revisited or Polymorphic Paths" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2008/01/sti-views-revisited-or-polymorphic.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIFQHc5cSp7ImA9WxZTEEU.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-4412430651083949424</id><published>2008-01-11T11:24:00.000-08:00</published><updated>2008-01-11T12:31:51.929-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-11T12:31:51.929-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Single Table Inheritance" /><category scheme="http://www.blogger.com/atom/ns#" term="scaffold" /><category scheme="http://www.blogger.com/atom/ns#" term="STI" /><title>STI Experiment 1 - Scaffolded STI Sub-Classes</title><content type="html">&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;/span&gt;I was having problem listing STI related objects from the same table.&lt;br /&gt;Here are my experiment with trying to work through the problems.&lt;br /&gt;&lt;br /&gt;My first experiment will try to create 2 completely scaffolded models, create a simple STI hierarchy between them and see how Rails handles it.&lt;br /&gt;&lt;br /&gt;At the command line:&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;ruby script\generate scaffold Parent name:string description:text&lt;/code&gt;&lt;br /&gt;&lt;code&gt;rake db:migrate&lt;/code&gt;&lt;br /&gt;&lt;code&gt;ruby script\generate scaffold Son member:string&lt;/code&gt;&lt;br /&gt;&lt;/blockquote&gt;Make 2 changes to the generated code:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Change the migration from creating a new sons table to adding 2 new columns to the parents table:&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;add_column :parents, :member, :string&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;add_column :parents, :type, :string    # needed for STI&lt;br /&gt;&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Make Son (in &lt;code&gt;app/models/son.rb&lt;/code&gt;) derive from Parent (instead of &lt;code&gt;ActiveRecord::Base&lt;/code&gt;)&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;code&gt;rake db:migrate&lt;/code&gt; again, and add a few Parents and a Son (through the console).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Result&lt;br /&gt;&lt;/span&gt;At URL &lt;code&gt;/parents&lt;/code&gt; all Parents &lt;span style="font-style: italic;"&gt;and&lt;/span&gt; Sons are listed, since they are all saved in the same table.&lt;br /&gt;This is the desired behavior which would be expected with an &lt;span style="font-style: italic;"&gt;is-a&lt;/span&gt; relationship between Sons and Parents. (Note that I use parent and son names in the parent i.e. base class and son i.e. derived class meaning and not in the genealogical sense)&lt;br /&gt;This view is generated by the scaffold generator script, and is actually &lt;code&gt;app\views\parents\index.html.erb&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;Since Sons are derived but different types from Parents it might be expected that the Show, Edit and Destroy links for actual concrete Sons will link to the (automatically generated) Son controller and the &lt;span style="font-style: italic;"&gt;not&lt;/span&gt; to the Parent controller. This would essentially be equivalent to calling virtual methods.&lt;br /&gt;&lt;br /&gt;This actually happens for the Show and Destroy links. However, the Edit link still redirects to the Parent edit page. The problem apparently stems from the Parent index view:&lt;pre&gt;&lt;%= link_to 'Show', parent %&gt;&lt;br /&gt;&lt;%= link_to 'Edit', &lt;span style="font-weight: bold;"&gt;edit_parent_path(parent)&lt;/span&gt; %&gt;&lt;br /&gt;&lt;%= link_to 'Destroy', parent, :confirm =&gt; 'Are you sure?', :method =&gt; :delete %&gt;&lt;br /&gt;&lt;/pre&gt;the &lt;code&gt;edit_parent_path(parent)&lt;/code&gt; seems to be not as smart as &lt;code&gt;link_to&lt;/code&gt; in detecting the STI hierarchy on the parent object.&lt;br /&gt;&lt;br /&gt;I don't know how to bypass this at the moment.&lt;br /&gt;I will update this post if and when I have a working solution.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;If you found this post helpful, or you can shed some light on this problem, please leave a message in the comments. If you want to read more about my exploration of &lt;a href="http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming"&gt;polymorphism&lt;/a&gt; and STI on Rails, subscribe to the &lt;a href="http://rookieonrails.blogspot.com/feeds/posts/default"&gt;blog feed&lt;/a&gt; and stay updated.&lt;br /&gt;&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/c9MLdcNdxH8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/4412430651083949424/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=4412430651083949424" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/4412430651083949424?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/4412430651083949424?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/c9MLdcNdxH8/sti-experiments-scaffolded-sti-sub.html" title="STI Experiment 1 - Scaffolded STI Sub-Classes" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2008/01/sti-experiments-scaffolded-sti-sub.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MBRHkzfCp7ImA9WB9aGUg.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-6208799218892596529</id><published>2008-01-09T12:17:00.000-08:00</published><updated>2008-01-10T02:04:15.784-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-10T02:04:15.784-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Single Table Inheritance" /><category scheme="http://www.blogger.com/atom/ns#" term="polymorphism" /><category scheme="http://www.blogger.com/atom/ns#" term="OOP" /><category scheme="http://www.blogger.com/atom/ns#" term="STI" /><title>Single Table Inheritance in Rails</title><content type="html">I've been experimenting with Single Table Inheritance or STI.&lt;br /&gt;STI documentation is rather sparse, distributed, confusing and lacking so I hope to make some sense out of it.&lt;br /&gt;&lt;br /&gt;The Wiki &lt;a href="http://wiki.rubyonrails.org/rails/pages/SingleTableInheritance"&gt;describes&lt;/a&gt; &lt;strong style="font-style: italic; font-weight: normal;"&gt;Single Table Inheritance&lt;/strong&gt; like this:&lt;blockquote&gt;&lt;strong style="font-style: italic; font-weight: normal;"&gt;Single Table Inheritance&lt;/strong&gt;&lt;span style="font-style: italic;"&gt; r&lt;/span&gt;epresents an inheritance hierarchy of classes as a single table that has columns for all the fields of the various classes.&lt;/blockquote&gt;Martin Fowler &lt;a href="http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html"&gt;explains&lt;/a&gt;:&lt;blockquote&gt;Relational databases don't support inheritance, so when mapping from objects to databases we have to consider how to represent our nice inheritance structures in relational tables. ... &lt;span style="font-style: italic;"&gt;Single Table Inheritance &lt;/span&gt;maps all fields of all classes of an inheritance structure into a single table.&lt;/blockquote&gt;What this means, is that at the DB table level all records (objects) from all levels of the type hierarchy (classes) have all the fields (members) of all the other classes (and direct access to them). In other words, the table fields are the &lt;span style="font-style: italic;"&gt;union&lt;/span&gt; of all the members of all the classes in the hierarchy (plus one special field called :type).&lt;br /&gt;Due to this fact, obviously, two classes in the hierarchy cannot have two differently typed members with the same name.&lt;br /&gt;&lt;br /&gt;Interestingly enough, this kind of inheritance actually goes against some of OOP's main tennets such as, data decoupling, &lt;a href="http://en.wikipedia.org/wiki/Information_hiding"&gt;data encapsulation/hiding&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Class_%28computer_science%29#Information_hiding_and_encapsulation"&gt;access control&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Separation_of_concerns"&gt;separation of concerns&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;These issues notwithstanding, STI can still be useful.&lt;br /&gt;&lt;br /&gt;To build your hierarchy, say by sub-classing from &lt;span style="font-family:courier new;"&gt;Person&lt;/span&gt;, generate a migration script:&lt;blockquote&gt;&lt;code&gt;&gt;&gt;ruby script/generate migration AddColumnsForPersonHierarchy&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;then in the resulting migration file add all the additional columns you need for any or all the classes of your hierarchy. Additionally, add the special  string column, &lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001398"&gt;conventionally&lt;/a&gt; called &lt;span style="font-family:courier new;"&gt;:type&lt;/span&gt;. Rails will automatically fill &lt;span style="font-family:courier new;"&gt;:type &lt;/span&gt;with the actual class name.&lt;br /&gt;&lt;br /&gt;Then, add your class models by &lt;span style="font-weight: bold;"&gt;giving each class a separate file&lt;/span&gt;, e.g. create a new file &lt;span style="font-family:courier new;"&gt;app/models/employee.rb&lt;/span&gt;:&lt;blockquote&gt;&lt;pre&gt;class Employee &lt; Person &lt;br /&gt; validates_presence_of :department&lt;br /&gt;end&lt;/pre&gt;&lt;/blockquote&gt;You could do it all in one model file, as shown in various example on the web, (e.g. in &lt;span style="font-family:courier new;"&gt;app/models/person.rb&lt;/span&gt;) but that creates lookup problems for Rails, so that &lt;span style="font-family:courier new;"&gt;Employee&lt;/span&gt; will not be found before &lt;span style="font-family:courier new;"&gt;Person&lt;/span&gt; is first used.&lt;br /&gt;&lt;br /&gt;For improving class data consistency we can, inside our class models, &lt;span style="font-family:courier new;"&gt;validates_presence_of&lt;/span&gt; any fields that are relevant just for this class, as shown in the example above. Other classes can accept &lt;span style="font-family:courier new;"&gt;nil&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;In the next post in this series I will explore the how to add controllers to our STI hierarchy. I will also investigate how far Rails can allow true &lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming"&gt;polymorphism&lt;/a&gt; with STI.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;If you found this post helpful, please leave a message in the comments. If you want to read more about my exploration of &lt;a href="http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming"&gt;polymorphism&lt;/a&gt; and STI on Rails, subscribe to the &lt;a href="http://rookieonrails.blogspot.com/feeds/posts/default"&gt;blog feed&lt;/a&gt; and you won't miss a thing.&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/dRG-6NNkHdU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/6208799218892596529/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=6208799218892596529" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/6208799218892596529?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/6208799218892596529?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/dRG-6NNkHdU/single-table-inheritance-in-rails.html" title="Single Table Inheritance in Rails" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2008/01/single-table-inheritance-in-rails.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUHRHo5cSp7ImA9WB9aGE8.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-4112993984779786691</id><published>2008-01-08T11:48:00.000-08:00</published><updated>2008-01-08T11:57:15.429-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-08T11:57:15.429-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Rails 2.0" /><category scheme="http://www.blogger.com/atom/ns#" term="InstantRails" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><title>Instant Rails 2.0</title><content type="html">&lt;a href="http://instantrails.rubyforge.org/wiki/wiki.pl?Instant_Rails"&gt;     Instant Rails&lt;/a&gt; 2.0 was recently released.&lt;br /&gt;It contains the following major changes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Upgrades Ruby to version 1.8.6 Patch Level 111&lt;/li&gt;&lt;li&gt;Upgrades Rails to 2.0.2&lt;/li&gt;&lt;li&gt;Upgrades Mongrel to 1.1.2&lt;/li&gt;&lt;li&gt;Upgrades RubyGems to 1.0.1&lt;/li&gt;&lt;li&gt;Upgrades Rake to 0.8.1&lt;/li&gt;&lt;li&gt;Upgraded Cookbook app to support Rails 2.0.2&lt;/li&gt;&lt;li&gt;Added SQLite3 Support&lt;/li&gt;&lt;li&gt;Added Capistrano 2.1.0&lt;/li&gt;&lt;/ul&gt; You can download Instant Rails &lt;a href="http://rubyforge.org/frs/?group_id=904"&gt;here&lt;/a&gt; and read the complete release notes &lt;a href="http://instantrails.rubyforge.org/wiki/wiki.pl?Release_Notes_For_Instant_Rails_2.0"&gt;here&lt;/a&gt;.&lt;br /&gt;I have not tried it yet, but will probably do so soon.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://instantrails.rubyforge.org/wiki/wiki.pl?Release_Notes_For_Instant_Rails_2.0" target="_new"&gt;&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/6g6TZv3UDdM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/4112993984779786691/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=4112993984779786691" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/4112993984779786691?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/4112993984779786691?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/6g6TZv3UDdM/instant-rails-20.html" title="Instant Rails 2.0" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2008/01/instant-rails-20.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cCSXkyfSp7ImA9WB9aEU4.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-7547740632416616567</id><published>2007-12-31T11:42:00.000-08:00</published><updated>2007-12-31T11:57:48.795-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-31T11:57:48.795-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Droid" /><category scheme="http://www.blogger.com/atom/ns#" term="editor" /><category scheme="http://www.blogger.com/atom/ns#" term="fonts" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="RoRED" /><title>Rails Editor - Take 2</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_UtmU0ju5Uc4/R3lG-2NdQOI/AAAAAAAAAWs/etOeVwvr85E/s1600-h/RoRED.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_UtmU0ju5Uc4/R3lG-2NdQOI/AAAAAAAAAWs/etOeVwvr85E/s400/RoRED.png" alt="" id="BLOGGER_PHOTO_ID_5150225694392664290" border="0" /&gt;&lt;/a&gt;&lt;a href="http://www.plasmacode.com/"&gt;RoRED&lt;/a&gt; is "a free Ruby on Rails Editor for Win32". After some tweaking of the options, I find it very pleasant to work with. It still has a few rough corners but free is a hard price to beat, and it is a decent piece of work. Do give it a &lt;a href="http://www.plasmacode.com/"&gt;try&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Also, my current favorite programming font is &lt;a href="http://damieng.com/blog/2007/11/14/droid-sans-mono-great-coding-font"&gt;Droid Sans Mono&lt;/a&gt;. It comes from the  set of fonts to be used by the Android mobile operating system. It looks great in small sizes especially with ClearType.&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/lK2LokI_Iq4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/7547740632416616567/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=7547740632416616567" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/7547740632416616567?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/7547740632416616567?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/lK2LokI_Iq4/rails-editor-take-2.html" title="Rails Editor - Take 2" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_UtmU0ju5Uc4/R3lG-2NdQOI/AAAAAAAAAWs/etOeVwvr85E/s72-c/RoRED.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2007/12/rails-editor-take-2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0ADRXs_fyp7ImA9WB9bF0U.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-1610469502951186999</id><published>2007-12-22T13:45:00.000-08:00</published><updated>2007-12-27T13:09:34.547-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-27T13:09:34.547-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="InstantRails" /><category scheme="http://www.blogger.com/atom/ns#" term="ZenTest" /><category scheme="http://www.blogger.com/atom/ns#" term="autotest" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="testing" /><category scheme="http://www.blogger.com/atom/ns#" term="gem" /><title>AutoTest with InstantRails on Windows</title><content type="html">Testing you app is important. A useful and &lt;a href="http://nubyonrails.com/articles/autotest-rails"&gt;recommended&lt;/a&gt; plugin is the &lt;span style="font-family:courier new;"&gt;autotest&lt;/span&gt; plugin. Here's what is &lt;a href="http://www.zenspider.com/ZSS/Products/ZenTest/"&gt;says in the box&lt;/a&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;em&gt;Improves feedback&lt;/em&gt; by running tests continuously. &lt;/li&gt;&lt;li&gt;Continually runs tests based on &lt;em&gt;files you've changed&lt;/em&gt;. &lt;/li&gt;&lt;li&gt;Get &lt;em&gt;&lt;strong&gt;feedback as soon as you save&lt;/strong&gt;&lt;/em&gt;. Keeps you in your editor allowing you to &lt;em&gt;get stuff done faster&lt;/em&gt;. &lt;/li&gt;&lt;li&gt;&lt;em&gt;Focuses&lt;/em&gt; on running previous failures &lt;em&gt;until you've fixed them&lt;/em&gt;. &lt;/li&gt;&lt;/ul&gt;Cool. To get it type:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&gt;&gt;gem install ZenTest&lt;/pre&gt;&lt;/blockquote&gt;to run &lt;span style="font-family:courier new;"&gt;cd&lt;/span&gt; into your app dir and type:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&gt;&gt;autotest -rails&lt;/pre&gt;&lt;/blockquote&gt;Simple, isn't it?&lt;br /&gt;&lt;br /&gt;Well... not really.&lt;br /&gt;When I did this I got a whole bunch of error messages:&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;.../InstantRails/ruby/lib/ruby/gems/1.8/gems/ZenTest-3.6.1/lib/autotest.rb:435:in `expand_path': couldn't find HOME environment -- expanding `~/.autotest' (ArgumentError)&lt;br /&gt;from .../InstantRails/ruby/lib/ruby/gems/1.8/gems/ZenTest-3.6.1/lib/autotest.rb:435&lt;br /&gt;from .../InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'&lt;br /&gt;from .../InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'&lt;br /&gt;from .../InstantRails/ruby/lib/ruby/gems/1.8/gems/ZenTest-3.6.1/bin/autotest:35&lt;br /&gt;from .../InstantRails/ruby/bin/autotest:19:in `load'&lt;br /&gt;from .../InstantRails/ruby/bin/autotest:19&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;Turns out that it's looking for an environment variable called &lt;span style="font-family:courier new;"&gt;HOME&lt;/span&gt;. From my tests and from what I read you can put any valid path there. I just used the local path.&lt;br /&gt;Actually, I just set the variable before running autotest.&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&gt;&gt;set HOME=.&lt;br /&gt;&gt;&gt;autotest -rails&lt;/pre&gt;&lt;/blockquote&gt;However, a fresh new list of errors are now generated, the gist of them is this:&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;.../InstantRails/ruby/lib/ruby/gems/1.8/gems/ZenTest-3.6.1/lib/unit_diff.rb:187:in ''': No such file or directory - diff.exe -u D:/temp/expect.1480.0 D:/temp/butwas.1480.0n  (Errno::ENOENT)&lt;br /&gt;1.      from .../InstantRails/ruby/lib/ruby/gems/1.8/gems/ZenTest-3.6.1/lib/unit_diff.rb:187:in 'unit_diff'&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;Basically, it's complaining that it cannot find &lt;span style="font-family:courier new;"&gt;diff.exe&lt;/span&gt;. Of course, most (all?) Unix systems have this installed but my Windows machine with InstantRails does not, so therein lies the problem. &lt;a href="http://www.ruby-forum.com/topic/132952"&gt;This post&lt;/a&gt; explains it simply. Go &lt;a href="http://gnuwin32.sourceforge.net/packages/diffutils.htm"&gt;here&lt;/a&gt; to get &lt;span style="font-family:courier new;"&gt;diff.exe&lt;/span&gt; for Windows.&lt;br /&gt;&lt;br /&gt;Once installed (or unzipped), just set your path to wherever you put it, and run autotest. e.g.:&lt;pre&gt;&lt;blockquote&gt;&lt;pre&gt;&gt;&gt;set HOME=.&lt;br /&gt;&gt;&gt;set path=%path%;"C:\Program Files\GnuWin32\bin\"&lt;br /&gt;&gt;&gt;autotest -rails&lt;/pre&gt;&lt;/blockquote&gt;&lt;/pre&gt;Right? Wrong.&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;diff.exe&lt;/span&gt; is still not found. For some reason it's not enough to &lt;span style="font-family:courier new;"&gt;set&lt;/span&gt; the environment like this.&lt;br /&gt;&lt;br /&gt;You will need to &lt;span style="font-family:courier new;"&gt;set&lt;/span&gt; it in the Windows settings (Start-&gt; Settings-&gt; Control Panel-&gt; System-&gt; Advanced-&gt; Environment Variables...) and change the &lt;span style="font-family:courier new;"&gt;PATH&lt;/span&gt; variable to include the &lt;span style="font-family:courier new;"&gt;diff.exe&lt;/span&gt; path.&lt;br /&gt;&lt;br /&gt;Now you can begin enjoying the joys of &lt;span style="font-family:courier new;"&gt;autotest&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;If you found this post helpful, please leave a message in the comments. If you want to hear more about my adventures on the Rails, subscribe to the &lt;a href="http://rookieonrails.blogspot.com/feeds/posts/default"&gt;blog feed&lt;/a&gt; and you won't miss a thing.&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/IUhDWusLHvk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/1610469502951186999/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=1610469502951186999" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/1610469502951186999?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/1610469502951186999?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/IUhDWusLHvk/autotest-with-instantrails-on-windows.html" title="AutoTest with InstantRails on Windows" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>8</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2007/12/autotest-with-instantrails-on-windows.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08BQH45fip7ImA9WB9bF0U.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-5312512459262828820</id><published>2007-12-20T13:40:00.000-08:00</published><updated>2007-12-27T13:10:51.026-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-27T13:10:51.026-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="functional testing" /><category scheme="http://www.blogger.com/atom/ns#" term="restful_authentication" /><category scheme="http://www.blogger.com/atom/ns#" term="testing" /><title>Testing Headaches</title><content type="html">I was planning some additional posts before this one, but this really got on my nerves.&lt;br /&gt;&lt;br /&gt;Rails really wants to make it easy for you to test your programs. It provides a whole framework for testing. That's great and commendable.&lt;br /&gt;&lt;br /&gt;So, I finally took the plunge and started my project. I built some models, controllers and views using Rails 2.0's spiffy new RESTful scaffold generator, added user login management using the &lt;a href="http://agilewebdevelopment.com/plugins/restful_authentication"&gt;restful_authentication&lt;/a&gt; plugin (more on this in a later post), and tried running all the generated tests.&lt;br /&gt;&lt;br /&gt;Errors, failures and what not, and I haven't written any of these tests, they were all generated by the generators!&lt;br /&gt;&lt;br /&gt;The first problem was that all the functional tests should login &lt;span style="font-style: italic;"&gt;before&lt;/span&gt; the test is run. OK, that makes sense, the generator couldn't know I was behind the authentication "wall". Fine, but the &lt;a href="http://agilewebdevelopment.com/plugins/restful_authentication"&gt;restful_authentication&lt;/a&gt; plugin's documentation is practically non-existent.&lt;br /&gt;After searching around I found several forum posts that point to the &lt;span style="font-family:courier new;"&gt;login_as&lt;/span&gt; helper method. Just stick it in your &lt;span style="font-family:courier new;"&gt;setup&lt;/span&gt; method, they say, and you're home free:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;def setup&lt;br /&gt;login_as :quentin&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;the rest of the test &lt;span style="font-style: italic;"&gt;should&lt;/span&gt; work as before (&lt;span style="font-family:courier new;"&gt;:quentin&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;:aaron&lt;/span&gt; are the automatically generated users, they apparently work for &lt;a href="http://example.com/"&gt;example.com&lt;/a&gt;).&lt;br /&gt;However, no such thing happened.&lt;br /&gt;&lt;br /&gt;After, endless trials and errors, detours and hacks, I tried adding &lt;span style="font-family:courier new;"&gt;login_as &lt;/span&gt;to each method and &lt;span style="font-style: italic;"&gt;not&lt;/span&gt; through &lt;span style="font-family:courier new;"&gt;setup&lt;/span&gt;. Suddenly some of the tests passed without a problem. Those that didn't failed due to some other strange reason.&lt;br /&gt;Now, remember, these are &lt;span style="font-style: italic;"&gt;all&lt;/span&gt; auto-generated tests!&lt;br /&gt;&lt;br /&gt;Anyway, it seemed there was some problems accessing a model with &lt;span style="font-family:courier new;"&gt;:id&lt;/span&gt; of 1. I checked the &lt;span style="font-style: italic;"&gt;automatically &lt;/span&gt;generated fixtures, and, indeed, &lt;span style="font-family:courier new;"&gt;:id&lt;/span&gt; was not set! Didn't anyone test this Rails release?! This is the newest public release of Rails.&lt;br /&gt;&lt;br /&gt;So, I added the &lt;span style="font-family:courier new;"&gt;:id&lt;/span&gt;s  and lo and behold, &lt;span style="font-style: italic;"&gt;most &lt;/span&gt;of the tests now passed.&lt;br /&gt;I later &lt;a href="http://weblog.rubyonrails.com/2007/12/17/rails-2-0-2-some-new-defaults-and-a-few-fixes"&gt;discovered&lt;/a&gt; that one of the fixes done in Rails 2.0.2 &lt;a href="http://weblog.rubyonrails.com/2007/12/17/rails-2-0-2-some-new-defaults-and-a-few-fixes"&gt;were&lt;/a&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Fixed that functional tests generated for scaffolds should use fixture calls instead of hard-coded IDs&lt;/li&gt;&lt;/ul&gt;scroll down, it's the forth item from the end. Of course, this doesn't help me, since I scaffolded using ver. 2.0.1. Arghhhh!&lt;br /&gt;&lt;br /&gt;By adding the mandatory record fields in the &lt;span style="font-family:courier new;"&gt;test_should_create_*&lt;/span&gt; tests, I got all the test to run properly. Being a rookie this also took me a while to figure out thanks to the "helpful" error messages.&lt;br /&gt;&lt;br /&gt;What still bugged me was why I couldn't use the &lt;span style="font-family:courier new;"&gt;setup&lt;/span&gt; method. After some serious and associative digging I found &lt;a href="http://quotedprintable.com/2007/12/5/potential-gotcha-with-test-setup-in-rails-2-0"&gt;this&lt;/a&gt; little post:&lt;blockquote&gt;Rails 2.0 introduces a new (better) way to create your functional test cases. Instead of subclassing Test::Unit::TestCase directly, you can now subclass ActionController::TestCase, which will take care of the setting up the request/response environment for you.&lt;br /&gt;...&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;And therein lies the gotcha:&lt;/span&gt; if you go ahead and create your own setup method not realizing that you’ve inherited one, you’ll clobber the one defined in the superclass. So, when you’re defining your own setup method, &lt;span style="font-weight: bold;"&gt;remember to call the original one using super&lt;/span&gt;...&lt;/blockquote&gt;so when I changed my &lt;span style="font-family:courier new;"&gt;setup&lt;/span&gt; method to look like this:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;def setup&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  &lt;/span&gt;&lt;span&gt;super&lt;/span&gt;&lt;br /&gt;login_as :quentin&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;everything suddenly worked.&lt;br /&gt;&lt;br /&gt;Now, it took &lt;a href="http://quotedprintable.com/2007/12/5/potential-gotcha-with-test-setup-in-rails-2-0"&gt;Jeffrey Allan Hardy&lt;/a&gt; 15 minutes to figure this out and he wrote a &lt;a href="http://www.amazon.com/gp/product/1590596862?ie=UTF8&amp;amp;tag=rooonrai-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1590596862"&gt;book&lt;/a&gt; about Rails and is a partner at a boutique Rails consulting shop (whatever that means). It took me hours!&lt;br /&gt;He updated his post to mention that this "gotcha" has been fixed on the Rails Trac (the Rails source repository) but that isn't much consolation nor use to me.&lt;br /&gt;&lt;br /&gt;All my tests now pass and I'm going to sleep.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;If you found this post helpful, please leave a message in the comments.&lt;br /&gt;If you want to hear more about my mis-adventures with Rails, subscribe to the &lt;a href="http://rookieonrails.blogspot.com/feeds/posts/default"&gt;blog feed&lt;/a&gt; and you just might not have to go through it yourself.&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/UAFyKVu3OmM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/5312512459262828820/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=5312512459262828820" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/5312512459262828820?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/5312512459262828820?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/UAFyKVu3OmM/testing-headaches.html" title="Testing Headaches" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2007/12/testing-headaches.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cMQnk_cCp7ImA9WB9aEU4.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-2698637849973096008</id><published>2007-12-17T13:17:00.000-08:00</published><updated>2007-12-31T11:58:03.748-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-31T11:58:03.748-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Rails 2.0" /><category scheme="http://www.blogger.com/atom/ns#" term="Railscasts" /><category scheme="http://www.blogger.com/atom/ns#" term="editor" /><category scheme="http://www.blogger.com/atom/ns#" term="fonts" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="Notepad++" /><category scheme="http://www.blogger.com/atom/ns#" term="TextMate" /><category scheme="http://www.blogger.com/atom/ns#" term="E-TextEditor" /><title>Editor for Rails</title><content type="html">Many Rails developers use &lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt; (€39) for developing Rails apps. &lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt; &lt;span style="font-style: italic;"&gt;seems&lt;/span&gt; like a very powerful editor with auto-completion bordering on the telepathic. You can see &lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt; in action in many Rails screencasts, for example on the excellent Rails casts at &lt;a href="http://www.railscasts.com/"&gt;Railscasts&lt;/a&gt;.&lt;br /&gt;I say &lt;span style="font-style: italic;"&gt;seems &lt;/span&gt;because &lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt; is only available for Macs and I'm a Windows user.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.e-texteditor.com/"&gt;E-TextEditor&lt;/a&gt; ($34.95) is promoted as "The Power of TextMate on Windows", and it's pretty nice, though its still a bit rough in my opinion. You can get the look of TextMate with some real pretty color schemes.&lt;br /&gt;&lt;br /&gt;If you really want to go for the TextMate look, you can even download the &lt;a href="http://www.webdevkungfu.com/files/MONACO.TTF"&gt;Monaco font&lt;/a&gt; (via &lt;a href="http://www.webdevkungfu.com/textmate-envy-aka-monaco-font-for-windows/"&gt;WebDevKungfu&lt;/a&gt;), though some symbols are sometimes rendered over each other.&lt;br /&gt;Also, my Win2K system doesn't do any ClearType font rendering so it also doesn't look as good in small sizes.&lt;br /&gt;&lt;br /&gt;I suggest you stick with Courier, Lucida Console or &lt;a href="http://www.dafont.com/bitstream-vera-mono.font"&gt;Bitstream Vera Sans Mono&lt;/a&gt;. If there is interest I might write up a post about mono-spaced programming fonts.&lt;br /&gt;&lt;br /&gt;Another useful editor is &lt;a href="http://notepad-plus.sourceforge.net/uk/site.htm"&gt;Notepad++&lt;/a&gt;. This is an Open Source project and it is pretty decent. Do give it a try. Although it supports Ruby syntax highlighting it does not recognize Rails extensions like &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;.rhtml&lt;/span&gt;&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;That said, neither Notepad++ nor E support the new Rails 2.0 file extensions like &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;.erb&lt;/span&gt;&lt;/span&gt; files (which are really just &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;.rhtml&lt;/span&gt;&lt;/span&gt; files).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;If you found this post helpful, please leave a message in the comments.&lt;br /&gt;If you want to hear more about my Rails trials and tribulations, subscribe to the &lt;a href="http://rookieonrails.blogspot.com/feeds/posts/default"&gt;blog feed&lt;/a&gt; and you just might be spared.&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/R6lXWAYYdhw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/2698637849973096008/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=2698637849973096008" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/2698637849973096008?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/2698637849973096008?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/R6lXWAYYdhw/editor-for-rails.html" title="Editor for Rails" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2007/12/editor-for-rails.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcARns8eSp7ImA9WB9bF0Q.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-66048597032651753</id><published>2007-12-16T00:33:00.002-08:00</published><updated>2007-12-27T13:14:07.571-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-27T13:14:07.571-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MySQL" /><category scheme="http://www.blogger.com/atom/ns#" term="SQLite" /><category scheme="http://www.blogger.com/atom/ns#" term="Rails 2.0" /><category scheme="http://www.blogger.com/atom/ns#" term="InstantRails" /><category scheme="http://www.blogger.com/atom/ns#" term="rake" /><category scheme="http://www.blogger.com/atom/ns#" term="gem" /><title>Rails 2.0</title><content type="html">On Dec. 7th Rails 2.0 was &lt;a href="http://weblog.rubyonrails.com/2007/12/7/rails-2-0-it-s-done"&gt;unleashed onto the world&lt;/a&gt;.&lt;br /&gt;We all know that Rails is &lt;span style="font-style: italic;"&gt;very &lt;/span&gt;Web 2.0, though this 2.0 is not really that kind of 2.0, it's just Rails ver. 2.0.&lt;br /&gt;&lt;br /&gt;Anyway, there are some cool things about it and some annoying things about it.&lt;br /&gt;&lt;br /&gt;Most of the basic tutorials and books that I used to start learning RoR are now somewhat incompatible with Rails 2.0. This is especially true for the very basic stuff when getting started.&lt;br /&gt;On the other hand, Rails 2.0 makes some very basic things easier to do.&lt;br /&gt;&lt;br /&gt;For example, before Rails 2.0, you had to write some simple but obscure MySQL commands to set up the DB,  before you even got started with your app.&lt;br /&gt;&lt;br /&gt;In Rails 2.0 you can now create the DBs directly with Rails using:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;rake db:create&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;This is cool and consistent with the fact that the rest of the DB interaction is done with Rails (via migrations).&lt;br /&gt;&lt;br /&gt;Upgrading to Rails 2.0 with &lt;a href="http://instantrails.rubyforge.org/wiki/wiki.pl"&gt;InstantRails&lt;/a&gt; didn't go smoothly.&lt;br /&gt;When I ran the recommended command:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;gem install rails -y&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;The install failed with the following message:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;ERROR:  While executing gem ... (Zlib::BufError)&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;A little Googling &lt;a href="http://www.ruby-forum.com/topic/134400"&gt;revealed&lt;/a&gt; the following &lt;a href="http://www.ruby-forum.com/topic/134400#599114"&gt;suggestion&lt;/a&gt;:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;Try this command:&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;gem update --system&lt;/code&gt;&lt;/blockquote&gt;It will update your RubyGems to 0.9.5, and you will be able to install&lt;br /&gt;Rails 2.0 without problem.&lt;/pre&gt;&lt;/blockquote&gt;and indeed this worked for me, and properly updated &lt;a href="http://instantrails.rubyforge.org/wiki/wiki.pl"&gt;InstantRails&lt;/a&gt; to Rails 2.0.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Update:&lt;/span&gt; as I was writing this post (somewhat retrospectively), I &lt;a href="http://www.softiesonrails.com/2007/12/17/rails-2-0-2"&gt;noticed&lt;/a&gt; that Rails 2.0.2 is &lt;a href="http://weblog.rubyonrails.org/2007/12/17/rails-2-0-2-some-new-defaults-and-a-few-fixes"&gt;out&lt;/a&gt;.&lt;br /&gt;Although it is &lt;a href="http://www.softiesonrails.com/2007/12/17/rails-2-0-2"&gt;recommended&lt;/a&gt; to upgrade, what worries me is that the default DB now is SQLite3 and not MySQL. This means that new projects in InstantRails will probably not run out of the box since InstantRails is shipped with MySQL and not SQLite3. &lt;a href="http://weblog.rubyonrails.org/2007/12/17/rails-2-0-2-some-new-defaults-and-a-few-fixes"&gt;Changing the DB for a new project is apparently simple&lt;/a&gt;, but I have not done it so I cannot vouch for that:&lt;br /&gt;&lt;blockquote&gt;If you want to preconfigure your database for MySQL (or any of the other adapters), you simply do “rails -d mysql myapp” and everything is the same as before. But if you’re just playing with a new application or building a smallish internal tool, then I strongly recommend having a look at SQLite3. Thanks to the agnostic db/schema.rb, it’s as easy as changing your config/database.yml to switch from SQLite3 to MySQL (or another database) as soon as your load warrants it.&lt;/blockquote&gt;Note that to upgrade you run the same command:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;gem install rails&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;The &lt;span style="font-family:courier new;"&gt;-y&lt;/span&gt; switch (which appeared before) is to "Unconditionally install the required dependent gems".  For more help on &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;gem&lt;/span&gt;&lt;/span&gt; type &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;gem&lt;/span&gt;&lt;/span&gt; on the command line (Ruby Console Window in InstantRails). For more help on &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;gem install&lt;/span&gt;&lt;/span&gt; type:&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;gem help install&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;If you found this post helpful, please leave a message in the comments.&lt;br /&gt;If you want to hear more about a Rookie and Rails, you can subscribe to the &lt;a href="http://rookieonrails.blogspot.com/feeds/posts/default"&gt;blog feed&lt;/a&gt; never miss out.&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/G6voWWMkbL8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/66048597032651753/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=66048597032651753" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/66048597032651753?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/66048597032651753?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/G6voWWMkbL8/rails-20.html" title="Rails 2.0" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2007/12/rails-20.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUECQXc6eip7ImA9WB9bFUU.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-5159366699274331883</id><published>2007-12-16T00:33:00.001-08:00</published><updated>2007-12-25T05:01:00.912-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-25T05:01:00.912-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="InstantRails" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="BitNami" /><title>Setting Up Ruby on Rails</title><content type="html">I use Windows (2000). When I started this project a few weeks ago the recommended option for Windows was installing &lt;a href="http://instantrails.rubyforge.org/wiki/wiki.pl?Instant_Rails"&gt;InstantRails&lt;/a&gt;.&lt;br /&gt;&lt;blockquote style="font-style: italic;"&gt;Instant Rails is a one-stop Rails runtime solution containing Ruby, Rails, Apache, and MySQL, all pre-configured and ready to run. No installer, you simply drop it into the directory of your choice and run it. It does not modify your system environment.&lt;/blockquote&gt;That's what I installed and it seems to work just fine and dandy.&lt;br /&gt;&lt;br /&gt;A few days ago, while trying to read about upgrading to Rails 2.0, the &lt;a href="http://instantrails.rubyforge.org/wiki/wiki.pl?Instant_Rails"&gt;InstantRails&lt;/a&gt; web site said:&lt;br /&gt;&lt;blockquote style="font-style: italic;"&gt;Instant Rails is no longer being maintained and has been replaced by the &lt;a href="http://www.bitnami.com/stack/rubystack"&gt;BitNami RubyStack&lt;/a&gt;.&lt;br /&gt;&lt;/blockquote&gt;I actually tried installing  the &lt;a href="http://www.bitnami.com/stack/rubystack"&gt;BitNami RubyStack&lt;/a&gt; but the installation failed on my system.&lt;br /&gt;&lt;br /&gt;Anyway, today that note has changed and it now reads:&lt;br /&gt;&lt;blockquote style="font-style: italic;"&gt;&lt;a href="http://rbazinet.wordpress.com/2007/12/13/instant-rails-lives-on/"&gt;Rob Bazinet&lt;/a&gt; has offered to take over the Instant Rails project and will soon be releasing a new version feature Rails 2.0. [&lt;a href="http://rbazinet.wordpress.com/2007/12/13/instant-rails-lives-on/" rel="bookmark" title="Permanent Link to Instant Rails Lives On"&gt;Instant Rails Lives On&lt;/a&gt;]&lt;/blockquote&gt;Way to go Rob.&lt;br /&gt;&lt;br /&gt;So, that's one unnecessary annoying detour I took but is hopefully now taken care of.&lt;br /&gt;&lt;a href="http://instantrails.rubyforge.org/wiki/wiki.pl?Instant_Rails"&gt;InstantRails&lt;/a&gt; does just what it says on the box, unzip it and use it.&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/ayOfz6Pq7Cw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/5159366699274331883/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=5159366699274331883" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/5159366699274331883?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/5159366699274331883?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/ayOfz6Pq7Cw/setting-up.html" title="Setting Up Ruby on Rails" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2007/12/setting-up.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIESX08eyp7ImA9WB9UF0Q.&quot;"><id>tag:blogger.com,1999:blog-2810942822069011853.post-9104569000805824878</id><published>2007-12-15T13:43:00.000-08:00</published><updated>2007-12-16T00:25:08.373-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-16T00:25:08.373-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RoR" /><category scheme="http://www.blogger.com/atom/ns#" term="Ruby on Rails" /><category scheme="http://www.blogger.com/atom/ns#" term="Rookie on Rails" /><category scheme="http://www.blogger.com/atom/ns#" term="Rookie" /><category scheme="http://www.blogger.com/atom/ns#" term="Hello World" /><title>Rookie Indeed!</title><content type="html">I'll come out and say it right away:&lt;br /&gt;&lt;span style="font-size:130%;"&gt;I have &lt;span style="font-style: italic;"&gt;no &lt;/span&gt;web development experience.&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;I have &lt;span style="font-style: italic;"&gt;no &lt;/span&gt;web development experience.&lt;/span&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt; &lt;/span&gt;&lt;br /&gt;Zero. Nada. Zilch.&lt;br /&gt;No CSS, XML, SQL or any other acronym. Yeah, I can do basic HTML stuff circa 1997, but nothing beyond basic linking. I don't know PHP, Perl, Python, JavaScript or Ruby for that matter.&lt;br /&gt;&lt;br /&gt;There, I said it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;but&lt;/span&gt;... I have an itch.&lt;br /&gt;&lt;br /&gt;I have this idea for a cool little web site, I guess you could say a &lt;span style="font-style: italic;"&gt;Web 2.0&lt;/span&gt; web application (nothing for Google to worry about).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;So&lt;/span&gt;, says I, why not do it myself. I'm a capable programmer, and I always like to learn something new. &lt;a href="http://www.rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt; (RoR) seems to be all the rage these days, so why not?&lt;br /&gt;&lt;br /&gt;A professional RoR developer can probably whip it up in a few hours or less, but why should s/he have all the fun.&lt;br /&gt;&lt;br /&gt;Thus, I shall be spending my precious 1-2 evening hours of spare time (when available), over the coming months, pursuing this worthy goal and hopefully learning something in the process.&lt;br /&gt;&lt;br /&gt;I'll be documenting my torments, stumblings and victories here, mostly as a log for me but also perhaps to help others in similar situations.&lt;img src="http://feeds.feedburner.com/~r/RookieOnRails/~4/CIja-ksxNr8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rookieonrails.blogspot.com/feeds/9104569000805824878/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2810942822069011853&amp;postID=9104569000805824878" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/9104569000805824878?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2810942822069011853/posts/default/9104569000805824878?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RookieOnRails/~3/CIja-ksxNr8/hello-world-or-rookie-indeed.html" title="Rookie Indeed!" /><author><name>A.S.</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://photos1.blogger.com/hello/135/2171/400/Noam%20Siluette.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://rookieonrails.blogspot.com/2007/12/hello-world-or-rookie-indeed.html</feedburner:origLink></entry></feed>
