<?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-1151397178864889664</id><updated>2024-10-02T06:45:59.916-04:00</updated><category term="ruby"/><category term="rails"/><category term="windows"/><category term="bdd"/><category term="cucumber"/><category term="test"/><category term="mac"/><category term="sqlite3"/><category term="embedded"/><category term="github"/><category term="heroku"/><category term="quotes"/><category term="ruby rails github"/><category term="ruby rake"/><category term="rvm"/><category term="webrat"/><category term="wx-nobbie"/><category term="wxruby"/><title type='text'>Bryan Ash</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-2825334658791478603</id><published>2013-08-05T23:22:00.000-04:00</published><updated>2013-08-06T00:24:52.511-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="rvm"/><title type='text'>When RVM can&#39;t fetch from http://ftp.ruby-lang.org/</title><content type='html'>I wanted to install Ruby 1.9.2. &amp;nbsp;Easy, I thought, that&#39;s as simple as &lt;b&gt;rvm install 1.9.2&lt;/b&gt;. &amp;nbsp;Unfortunately, it looks like http://ftp.ruby-lang.org/ is having a bad day.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://rvm.io/rvm/offline&quot; target=&quot;_blank&quot;&gt;http://rvm.io/rvm/offline&lt;/a&gt;&amp;nbsp;provides helpful instructions assuming you are starting with nothing. &amp;nbsp;I already have several Ruby versions installed, so my process was reduced to:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;shell&quot; courier=&quot;&quot; monospace=&quot;&quot; name=&quot;code&quot; new=&quot;&quot; ourier=&quot;&quot; style=&quot;background-color: black; color: white;&quot;&gt;$ curl -L http://www.mirrorservice.org/sites/ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p320.tar.bz2 -o ruby-1.9.2-p320.tar.bz2
$ mv ruby-1.9.2-p320.tar.bz2 ~/.rvm/archives/
$ rvm install 1.9.2-p320 --disable-binary
$ rvm use ruby-1.9.2 --default
&lt;/pre&gt;
&lt;br /&gt;
Not too shabby!  Many thanks to the RVM team.</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/2825334658791478603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2013/08/when-rvm-cant-fetch-from-httpftpruby.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/2825334658791478603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/2825334658791478603'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2013/08/when-rvm-cant-fetch-from-httpftpruby.html' title='When RVM can&#39;t fetch from http://ftp.ruby-lang.org/'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-555236052749571240</id><published>2010-12-05T22:45:00.010-05:00</published><updated>2010-12-07T21:16:52.862-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ruby rails github"/><title type='text'>Providing markdown engine options in HAML</title><content type='html'>I&#39;ve started looking into using &lt;a href=&quot;http://daringfireball.net/projects/markdown/&quot;&gt;Markdown&lt;/a&gt; in &lt;a href=&quot;http://www.rubyonrails.org/&quot;&gt;Rails&lt;/a&gt;.  I use &lt;a href=&quot;http://haml-lang.com&quot;&gt;HAML&lt;/a&gt; for rendering views, so markdown is handled by a HAML filter:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;xml&quot; name=&quot;code&quot;&gt;%h1 Here&#39;s some rendered Markdown
  :markdown
    = @model.markdown
&lt;/pre&gt;&lt;br /&gt;
This worked great, but I was concerned about javascript injection since the markdown would be provided by a user using a &lt;a href=&quot;https://github.com/derobins/wmd&quot;&gt;WMD editor&lt;/a&gt;.  I found that I could explicitly call RDiscount, with the :filter_html option, to render the markdown myself:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;xml&quot; name=&quot;code&quot;&gt;%h1 Here&#39;s some rendered Markdown
  != RDiscount.new(@model.markdown, :filter_html).to_html
&lt;/pre&gt;&lt;br /&gt;
This worked great, but I didn&#39;t want to have to remember this incantation every time I want to render some Markdown.  After some discussion with &lt;a href=&quot;https://github.com/nex3&quot;&gt;Nathan Weizenbaum&lt;/a&gt; the current maintainer of Haml, I realized that the answer is actually presented (somewhat indirectly) through the documentation.  The section on &lt;a href=&quot;http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#filters&quot;&gt;Custom Filters&lt;/a&gt; says &quot;You can also define your own filters. See &lt;a href=&quot;http://haml-lang.com/docs/yardoc/Haml/Filters.html&quot;&gt;Haml::Filters&lt;/a&gt; for details.&quot;.  You have to then follow on to &lt;a href=&quot;http://haml-lang.com/docs/yardoc/Haml/Filters/Base.html&quot;&gt;Haml::Filters::Base&lt;/a&gt; for the full story.&lt;br /&gt;
&lt;br /&gt;
In my Rails app, I created a custom Haml filter that overrides the original :markdown (so I don&#39;t accidentally forget and use an unsafe :markdown) config/initializers/haml.rb:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;module MyApp
  module Filters
    module Markdown
      include Haml::Filters::Base
      lazy_require &#39;rdiscount&#39;

      def render(text)
        ::RDiscount.new(text, :filter_html).to_html
      end
    end
  end
end
&lt;/pre&gt;&lt;br /&gt;
Now, whenever HAML renders a :markdown filter, it will filter the HTML and protect me against javascript injection attacks.</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/555236052749571240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2010/12/providing-markdown-engine-options-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/555236052749571240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/555236052749571240'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2010/12/providing-markdown-engine-options-in.html' title='Providing markdown engine options in HAML'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-885593172000081371</id><published>2010-12-02T20:57:00.000-05:00</published><updated>2010-12-02T20:57:49.541-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="heroku"/><title type='text'>Stop deploying unneccessary Gems in your Heroku slug</title><content type='html'>&lt;a href=&quot;http://heroku.com/&quot;&gt;Heroku&lt;/a&gt; published a handy tip in their newsletter today:&lt;br /&gt;
&lt;pre class=&quot;shell&quot; name=&quot;code&quot; style=&quot;background-color: black; color: white; font-family: &quot;Courier New,Courier,monospace;&quot;&gt;$ heroku config:add BUNDLE_WITHOUT=development:test
&lt;/pre&gt;Having set this and pushed a change to my Gemfile, my slug size went from 39.4MB down to 10.9MB.&lt;br /&gt;
&lt;br /&gt;
Smaller slugs compile and load faster.&lt;br /&gt;
&lt;br /&gt;
Thank you Heroku!</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/885593172000081371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2010/12/stop-deploying-unneccessary-gems-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/885593172000081371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/885593172000081371'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2010/12/stop-deploying-unneccessary-gems-in.html' title='Stop deploying unneccessary Gems in your Heroku slug'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-8672189856638203232</id><published>2010-11-22T16:44:00.001-05:00</published><updated>2010-12-02T20:22:44.235-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ruby rake"/><title type='text'>Rake duplicate task descriptions</title><content type='html'>Using Rake I can define tasks that get added to a collection of tasks for execution.&amp;nbsp; For example:&lt;br /&gt;
&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;desc &quot;one&quot;
task :one do
  puts &quot;one&quot;
end

desc &quot;all&quot;
task :all =&amp;gt; [:one]

desc &quot;two&quot;
task :two do
  puts &quot;two&quot;
end

desc &quot;all&quot;
task :all =&amp;gt; [:two]
&lt;/pre&gt;&lt;br /&gt;
Now, if I look at &lt;b&gt;rake --tasks&lt;/b&gt; I will see:&lt;br /&gt;
&lt;pre class=&quot;shell&quot; name=&quot;code&quot; style=&quot;background-color: black; color: white; font-family: &quot;Courier New,Courier,monospace;&quot;&gt;&amp;gt; rake --tasks
rake one     # one
rake two     # two
rake all     # all / all&lt;/pre&gt;&lt;br /&gt;
Rake has duplicated the description for the :all task.  Looking at the code for Rake I discovered that this can be avoided by terminating the :all task description with a period:&lt;br /&gt;
&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;desc &quot;one&quot;
desc &quot;all.&quot;
task :all =&amp;gt; [:one]

desc &quot;one&quot;
desc &quot;all.&quot;
task :all =&amp;gt; [:one]
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class=&quot;shell&quot; name=&quot;code&quot; style=&quot;background-color: black; color: white; font-family: &quot;Courier New,Courier,monospace;&quot;&gt;&amp;gt; rake --tasks
rake one     # one
rake two     # two
rake all     # all.&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/8672189856638203232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2010/11/rake-duplicate-task-descriptions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/8672189856638203232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/8672189856638203232'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2010/11/rake-duplicate-task-descriptions.html' title='Rake duplicate task descriptions'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-5388337764405985462</id><published>2009-11-07T14:25:00.002-05:00</published><updated>2009-11-07T14:59:25.698-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><title type='text'>Blogging software for Mac</title><content type='html'>&lt;p&gt;I used to use Windows Live Writer in the old days but now I&#39;m a trendy Mac user I need something suitable.&amp;nbsp; Seems like there are a number of paid options that people rate quite highly but I&#39;m too cheap to pay for software.
&lt;/p&gt;
&lt;p&gt;
I just tried Quamana and it looked promising.&amp;nbsp; Unfortunately it kept throwing errors, didn&#39;t download tags from Blogger and then failed to actually publish the post!
&lt;/p&gt;
&lt;p&gt;
I&#39;m now trying Flock which is a full featured browser built on the same stuff as Firefox, that happens to have a blog editor built in.&amp;nbsp; I don&#39;t think it&#39;s as clean as Live Writer, but appears to have enough functionality for my basic use.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/5388337764405985462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/11/blogging-software-for-mac.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/5388337764405985462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/5388337764405985462'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/11/blogging-software-for-mac.html' title='Blogging software for Mac'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-8187278569777746131</id><published>2009-11-07T10:13:00.001-05:00</published><updated>2010-03-19T14:35:46.860-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><title type='text'>MacBook Pro AirPort autoconnect</title><content type='html'>We just installed a new wireless router with WPA security (with the last one we were using WEP).&amp;nbsp; My MacBook Pro connected just fine first time.&amp;nbsp; The problem was that whenever I close the lid and reopen, the Airport would not automatically connect, it would ask me which network to connect to.&lt;br /&gt;
&lt;br /&gt;
The surprising solution was to move &lt;b&gt;/Applications/Utilities/&lt;/b&gt;&lt;b&gt;System Preferences.app&lt;/b&gt; into &lt;b&gt;/Applications/System Preferences.app&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now AirPort reconnects all by itself every time.</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/8187278569777746131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/11/macbook-pro-airport-autoconnect.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/8187278569777746131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/8187278569777746131'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/11/macbook-pro-airport-autoconnect.html' title='MacBook Pro AirPort autoconnect'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-2318714071841395237</id><published>2009-06-27T00:23:00.001-04:00</published><updated>2009-06-27T00:23:15.809-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="rails"/><title type='text'>Using simple_auto_complete</title><content type='html'>&lt;p&gt;I&#39;m working on my first public Rails application for managing small skydiving businesses.&amp;#160; The primary feature is to track when a person gets in an aircraft to make a skydive.&amp;#160; In skydiver speak, that&#39;s: &amp;quot;Jumpers are manifested in a Slot on a Load&amp;quot;. I&#39;m using a model named Account to hold Jumpers, Pilots and in fact anyone who does business with the dropzone.&lt;/p&gt; So, My models look like:   &lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;class Load &amp;lt; ActiveRecord::Base
  has_many :slots, :dependent =&amp;gt; :destroy
end&lt;/pre&gt;
and: 

&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;class Slot &amp;lt; ActiveRecord::Base
  belongs_to :account
end&lt;/pre&gt;
The form for editing a load contains: 

&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;%= render :partial =&amp;gt; &#39;slot&#39;, :collection =&amp;gt; @load.slots %&amp;gt;&lt;/pre&gt;
and the _slots.html.erb partial contains something like: 

&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;% fields_for &amp;quot;load[slot_attributes][]&amp;quot;, slot do |slot_form| -%&amp;gt;
  &amp;lt;%= slot_form.label :account_name, &#39;Jumper:&#39; %&amp;gt;
  &amp;lt;%= slot_form.text_field :account_name %&amp;gt;
&amp;lt;% end -%&amp;gt;&lt;/pre&gt;

&lt;p&gt;This all works great, so it&#39;s time for a little flair ... what I&#39;d like is for the Account.name field to present a list of accounts that match the text that I&#39;ve typed so far and allow me to pick one (like the Google search field does these days).&lt;/p&gt;

&lt;h3&gt;Enter &lt;a href=&quot;http://github.com/grosser/simple_auto_complete/tree&quot;&gt;simple_auto_complete&lt;/a&gt;.&lt;/h3&gt;

&lt;p&gt;The instructions in the README describe the steps to get the simplest example working but left me scratching my head.&amp;#160; What I needed was the following...&lt;/p&gt;

&lt;p&gt;In SlotsController (something I didn&#39;t even need before):&lt;/p&gt;

&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;class SlotsController &amp;lt; ApplicationController
  autocomplete_for :account, :name, :order =&amp;gt; &#39;name ASC&#39;
end&lt;/pre&gt;

&lt;p&gt;in _slot.html.erb, I changed to: &lt;/p&gt;

&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;% fields_for &amp;quot;load[slot_attributes][]&amp;quot;, slot do |slot_form| -%&amp;gt;
  &amp;lt;%= slot_form.label :account_name, &#39;Jumper:&#39; %&amp;gt;
  &amp;lt;%= slot_form.text_field :account_name, :class =&amp;gt; &#39;autocomplete&#39;, 
      :autocomplete_url =&amp;gt; autocomplete_for_account_name_slots_path %&amp;gt;
&amp;lt;% end -%&amp;gt;&lt;/pre&gt;
I updated my routes.rb to include: 

&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;map.resources :slots, :collection =&amp;gt; { :autocomplete_for_account_name =&amp;gt; :get}&lt;/pre&gt;
Finally, I added to my application.html.erb layout: 

&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;&amp;lt;%= stylesheet_link_tag &#39;site&#39;, &#39;jquery.autocomplete&#39; %&amp;gt;
&amp;lt;%= javascript_include_tag &#39;jquery&#39;, &#39;jquery.autocomplete&#39;, &#39;application&#39;, &#39;prototype&#39; %&amp;gt;&lt;/pre&gt;
And it works like a champ! 

  </content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/2318714071841395237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/06/using-simpleautocomplete.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/2318714071841395237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/2318714071841395237'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/06/using-simpleautocomplete.html' title='Using simple_auto_complete'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-6296280093149767239</id><published>2009-02-28T03:07:00.001-05:00</published><updated>2009-02-28T03:07:15.320-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="rails"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlite3"/><title type='text'>Permission denied - db/test.sqlite3</title><content type='html'>I&#39;m investigating creating a plugin for &lt;a href=&quot;http://www.redmine.org/&quot;&gt;Redmine&lt;/a&gt; and having a good old time when I decide to clear out the test database:   &lt;p&gt;C:\dev\redmine&amp;gt;rake db:test:purge   &lt;br /&gt;(in C:/dev/redmine)    &lt;br /&gt;rake aborted!    &lt;br /&gt;&lt;font color=&quot;#ff0000&quot;&gt;Permission denied - db/test.sqlite3&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Boo!&amp;#160; &lt;/p&gt;  &lt;p&gt;I don&#39;t know what made me think of it but I tried unsetting my RAILS_ENV environment variable (I had it set to &amp;quot;test&amp;quot;):&lt;/p&gt;  &lt;p&gt;C:\dev\redmine&amp;gt;set rails_env= &lt;/p&gt;  &lt;p&gt;C:\dev\redmine&amp;gt;rake db:test:purge   &lt;br /&gt;(in C:/dev/redmine) &lt;/p&gt;  &lt;p&gt;C:\dev\redmine&amp;gt;&lt;/p&gt;  &lt;p&gt;Hurrah!&lt;/p&gt;  </content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/6296280093149767239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/02/permission-denied-dbtestsqlite3.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/6296280093149767239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/6296280093149767239'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/02/permission-denied-dbtestsqlite3.html' title='Permission denied - db/test.sqlite3'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-852525474720528066</id><published>2009-02-22T11:06:00.001-05:00</published><updated>2009-02-22T11:06:51.747-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="github"/><title type='text'>Formatting README.rdoc on github</title><content type='html'>Github has a neat feature that displays a README file, that it finds in the root directory of a project, on the project page.  The &lt;a href=&quot;http://github.com/guides/readme-formatting&quot;&gt;README formatting&lt;/a&gt; page describes a number of different formats that it will render based on the file extension.  I tried renaming to README.rdoc but it still rendered as plain text.  The trouble was that the file was intended to be used with a full RDOC site for the source.  When I removed the &quot;link&quot; tags from the file and pushed ... Github renders it correctly ... Hurrah!   </content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/852525474720528066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/02/formatting-readmerdoc-on-github.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/852525474720528066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/852525474720528066'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/02/formatting-readmerdoc-on-github.html' title='Formatting README.rdoc on github'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-7013701348852249376</id><published>2009-02-14T22:57:00.002-05:00</published><updated>2009-02-14T23:00:09.975-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bdd"/><category scheme="http://www.blogger.com/atom/ns#" term="cucumber"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><category scheme="http://www.blogger.com/atom/ns#" term="wx-nobbie"/><category scheme="http://www.blogger.com/atom/ns#" term="wxruby"/><title type='text'>BDD WxRuby applications with Cucumber and Nobbie</title><content type='html'>&lt;p&gt;For a long time now, I&#39;ve been wanting to write some &lt;a href=&quot;http://github.com/aslakhellesoy/cucumber/tree&quot;&gt;Cucumber&lt;/a&gt; features to describe a &lt;a href=&quot;http://wxruby.rubyforge.org/wiki/wiki.pl&quot;&gt;WxRuby&lt;/a&gt; application I have. A couple of weeks ago, I found a library called wx-nobbie on Rubyforge that seems to be almost exactly what I was looking for.&amp;#160; It provides a simple, high level interface for driving WxRuby applications through commands like &amp;quot;click&amp;quot;, &amp;quot;choose&amp;quot; and &amp;quot;type&amp;quot;.&amp;#160; I had a little trouble getting the tests to pass to start with, but with a few minor tweaks I got there.&amp;#160; I contacted the original author and got his permission to take it forward.&lt;/p&gt;  &lt;p&gt;I created a GitHub repository for &lt;a href=&quot;http://github.com/bryan-ash/wx-nobbie/tree&quot;&gt;Wx-Nobbie&lt;/a&gt; and have made a few updates over the last week.&amp;#160; Currently, I&#39;ve got 4 feature scenarios with 10 steps:&lt;/p&gt;  &lt;pre&gt;C:\dev\wx-nobbie&amp;gt;rake features
(in C:/dev/wx-nobbie)
In order to test drive a WxRuby application  # features/acceptance_test.feature
As a developer
I want Nobbie to provide acceptance test access to the application
  &lt;font color=&quot;green&quot;&gt;Scenario: Choosing a radio button&lt;/font&gt;  # features/acceptance_test.feature:5
    &lt;font color=&quot;green&quot;&gt;Then &amp;quot;radio_button&amp;quot; is not chosen&lt;/font&gt;# features/step_definitions/acceptance_test_steps.rb:21
    &lt;font color=&quot;green&quot;&gt;When I choose &amp;quot;radio_button&amp;quot;&lt;/font&gt;     # features/step_definitions/acceptance_test_steps.rb:1
    &lt;font color=&quot;green&quot;&gt;Then &amp;quot;radio_button&amp;quot; is chosen&lt;/font&gt;    # features/step_definitions/acceptance_test_steps.rb:17

  &lt;font color=&quot;green&quot;&gt;Scenario: Choosing a check box&lt;/font&gt;  # features/acceptance_test.feature:10
    &lt;font color=&quot;green&quot;&gt;Then &amp;quot;check_box&amp;quot; is not chosen&lt;/font&gt;# features/step_definitions/acceptance_test_steps.rb:21
    &lt;font color=&quot;green&quot;&gt;When I choose &amp;quot;check_box&amp;quot;&lt;/font&gt;     # features/step_definitions/acceptance_test_steps.rb:1
    &lt;font color=&quot;green&quot;&gt;Then &amp;quot;check_box&amp;quot; is chosen&lt;/font&gt;    # features/step_definitions/acceptance_test_steps.rb:17

  &lt;font color=&quot;green&quot;&gt;Scenario: Type into a text control&lt;/font&gt;        # features/acceptance_test.feature:15
    &lt;font color=&quot;green&quot;&gt;When I type &amp;quot;123&amp;quot; into &amp;quot;text_ctrl&amp;quot;&lt;/font&gt;      # features/step_definitions/acceptance_test_steps.rb:5
    &lt;font color=&quot;green&quot;&gt;Then I should see &amp;quot;123&amp;quot; in &amp;quot;text_ctrl&amp;quot;&lt;/font&gt;  # features/step_definitions/acceptance_test_steps.rb:9

  &lt;font color=&quot;green&quot;&gt;Scenario: Type into a combo box&lt;/font&gt;           # features/acceptance_test.feature:19
    &lt;font color=&quot;green&quot;&gt;When I type &amp;quot;456&amp;quot; into &amp;quot;combo_box&amp;quot;&lt;/font&gt;      # features/step_definitions/acceptance_test_steps.rb:5
    &lt;font color=&quot;green&quot;&gt;Then I should see &amp;quot;456&amp;quot; in &amp;quot;combo_box&amp;quot;&lt;/font&gt;  # features/step_definitions/acceptance_test_steps.rb:9


4 scenarios
&lt;font color=&quot;green&quot;&gt;10 steps passed&lt;/font&gt;&lt;/pre&gt;

&lt;p&gt;With just these 4 scenarios, RCov tells me I have 62.9% coverage. &lt;/p&gt;

&lt;p&gt;Hurrah! &lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/7013701348852249376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/02/bdd-wxruby-applications-with-cucumber.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/7013701348852249376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/7013701348852249376'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/02/bdd-wxruby-applications-with-cucumber.html' title='BDD WxRuby applications with Cucumber and Nobbie'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-4588263150785248545</id><published>2009-01-25T10:29:00.002-05:00</published><updated>2009-03-28T20:07:57.012-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="test"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Building a Ruby Extension With Visual C++ Express 2008</title><content type='html'>&lt;span style=&quot;font-style:italic;&quot;&gt;Edit March 29, 2009: While the instructions below describe how to build the Win32::GuiTest extension, I didn&#39;t get very far with using it before I found &lt;a href=&quot;http://github.com/bryan-ash/wx-nobbie/tree&quot;&gt;Wx::Nobbie&lt;/a&gt; which I much prefer and have taken up the maintenance of at Github.&lt;/span&gt;
&lt;p&gt;I&#39;d like to be able to use Cucumber to drive the development of Windows applications so I went looking for something like Webrat for desktop GUI&#39;s. I found &lt;a href=&quot;http://raa.ruby-lang.org/project/win32-guitest/&quot;&gt;Win32::GuiTest&lt;/a&gt;.&amp;#160; There is a project of the same name on RubyForge that contains the same source but that&#39;s as far as that went.&amp;#160; &lt;/p&gt;  &lt;p&gt;Win32::GuiTest is a C extension that was compiled with Cygwin, so I wanted to rebuild a native version.&amp;#160; I found some instructions on &lt;a href=&quot;http://www.kleinfelter.com/build-ruby-guitest-win32&quot;&gt;Kevin Kleinfelter&#39;s blog&lt;/a&gt; that look much like below, but using VC++ 2008 I got to skip a couple of steps:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Download and install &lt;a href=&quot;http://www.microsoft.com/express/vc/&quot;&gt;Visual C++ Express Edition&lt;/a&gt; (this is free, I got the 2008 version) &lt;/li&gt;    &lt;li&gt;Edit $RUBY_HOME/lib/ruby/1.8/i386-mswin32/config.h and delete the “#error MSC version unmatch” line &lt;/li&gt;    &lt;li&gt;Open a Visual Studio 2008 Command Prompt      &lt;ul&gt;       &lt;li&gt;Start &lt;/li&gt;        &lt;li&gt;All Programs &lt;/li&gt;        &lt;li&gt;Microsoft Visual C++ 2008 Express Edition &lt;/li&gt;        &lt;li&gt;Visual Studio Tools &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;cd C:\temp\guitest020218\ext\cguitest      &lt;ul&gt;       &lt;li&gt;I&#39;m building the guitest extension &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;ruby extconf.rb &lt;/li&gt;    &lt;li&gt;nmake &lt;/li&gt;    &lt;li&gt;mt.exe -manifest cguitest.so.manifest -outputresource:cguitest.so;2      &lt;ul&gt;       &lt;li&gt;Copy and paste the command above. You need it all from the &#39;mt&#39; to the &#39;;2&#39; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;nmake install &lt;/li&gt;    &lt;li&gt;cd \temp\guitest020218 &lt;/li&gt;    &lt;li&gt;ruby install.rb config &lt;/li&gt;    &lt;li&gt;ruby install.rb install &lt;/li&gt;    &lt;li&gt;To test:      &lt;ul&gt;       &lt;li&gt;irb &lt;/li&gt;     &lt;/ul&gt;      &lt;ul&gt;       &lt;li&gt;require &#39;win32/guitest&#39; &lt;/li&gt;        &lt;li&gt;check response is &#39;=&amp;gt; true&#39; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ol&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/4588263150785248545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/01/building-ruby-extension-with-visual-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/4588263150785248545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/4588263150785248545'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/01/building-ruby-extension-with-visual-c.html' title='Building a Ruby Extension With Visual C++ Express 2008'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-8045940159935174106</id><published>2009-01-14T23:01:00.002-05:00</published><updated>2009-01-15T08:19:27.116-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="rails"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="test"/><title type='text'>My first Rails bug – accepted!</title><content type='html'>&lt;p&gt;At the time that I posted about &lt;a href=&quot;http://bryan-ash.blogspot.com/2008/09/my-first-rails-bug.html&quot;&gt;My first Rails bug&lt;/a&gt; the tests that existed for Action Pack contained failures and the only test in integration_upload_test.rb was:&lt;/p&gt;  &lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;assert_equal(:multipart_form, SessionUploadTest.last_request_type)&lt;/pre&gt;

&lt;p&gt;I felt that my change could be submitted with no tests because:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The change was trivial (6 characters) &lt;/li&gt;

  &lt;li&gt;The change was for a well known Windows file issue &lt;/li&gt;

  &lt;li&gt;The tests that existed didn’t pass &lt;/li&gt;

  &lt;li&gt;There were no example tests for me to build on &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Three months after I submitted the &lt;a href=&quot;http://rails.lighthouseapp.com/projects/8994/tickets/1065-multipart_body-truncates-file-in-windows&quot;&gt;ticket&lt;/a&gt;, &lt;a href=&quot;http://rails.lighthouseapp.com/users/1366&quot;&gt;Pratik&lt;/a&gt; dismissed it by changing its state to &lt;strong&gt;incomplete&lt;/strong&gt; with the comment “Missing a test case.”&amp;#160; Are these guys CRAZY?&amp;#160; No, no they are not.&amp;#160; Just because there were &lt;a href=&quot;http://www.pragprog.com/the-pragmatic-programmer/extracts/software-entropy&quot;&gt;broken windows&lt;/a&gt; in the neighborhood did not give me the right to break any more.&lt;/p&gt;

&lt;p&gt;So, I sucked it up, cloned the latest rails repository again and to my surprise … all the Action Pack tests passed! … and there was a nice simple example in multipart_params_parsing_test.rb:&lt;/p&gt;

&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;  test &amp;quot;uploads and reads file&amp;quot; do
    with_test_routing do
      post &#39;/read&#39;, :uploaded_data =&amp;gt; fixture_file_upload(FIXTURE_PATH + &amp;quot;/hello.txt&amp;quot;, &amp;quot;text/plain&amp;quot;)
      assert_equal &amp;quot;File: Hello&amp;quot;, response.body
    end
  end&lt;/pre&gt;

&lt;p&gt;This is too easy!&amp;#160; I added a test for my issue:&lt;/p&gt;

&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;  test &amp;quot;uploads and reads a binary file in windows&amp;quot; do
    with_test_routing do
      fixture_file = FIXTURE_PATH + &amp;quot;/mona_lisa.jpg&amp;quot;
      post &#39;/read&#39;, :uploaded_data =&amp;gt; fixture_file_upload(fixture_file, &amp;quot;image/jpg&amp;quot;)
      assert_equal &#39;File: &#39;.length + File.size(fixture_file), response.content_length
    end
  end&lt;/pre&gt;

&lt;p&gt;Watched it fail.&amp;#160; Added the magic 6 characters (“, ‘rb’”).&amp;#160; Watched it pass.&amp;#160; Wrapped it up and shipped it off.&amp;#160; The following morning I pick up an email letting me know that Pratik has reopened the ticket and assigned it to &lt;a href=&quot;http://rails.lighthouseapp.com/users/424&quot;&gt;Joshua Peek&lt;/a&gt; for review.&amp;#160; The change was committed before the day was out!&lt;/p&gt;

&lt;p&gt;Many thanks to Pratik and Josh for attending to this so promptly.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/8045940159935174106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/01/my-first-rails-bug-accepted.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/8045940159935174106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/8045940159935174106'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/01/my-first-rails-bug-accepted.html' title='My first Rails bug – accepted!'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-6710261044071847390</id><published>2009-01-12T22:13:00.002-05:00</published><updated>2009-01-13T07:19:57.886-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bdd"/><category scheme="http://www.blogger.com/atom/ns#" term="cucumber"/><category scheme="http://www.blogger.com/atom/ns#" term="rails"/><title type='text'>Restful-Authentication with Cucumber features (Step 2)</title><content type='html'>&lt;p&gt;Knowing that all the stories that ship with restful-authentication pass, I’m ready to convert to Cucumber features.&amp;#160; The process is actually fairly simple and is described quite clearly on this Cucumber &lt;a href=&quot;http://wiki.github.com/aslakhellesoy/cucumber/migration-from-rspec-stories&quot;&gt;wiki page&lt;/a&gt;.&amp;#160; I did have to tweak a couple of the step matchers and create ra_env.rb:&lt;/p&gt;  &lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;Before do
  Fixtures.reset_cache
  fixtures_folder = File.join(RAILS_ROOT, &#39;spec&#39;, &#39;fixtures&#39;)
  Fixtures.create_fixtures(fixtures_folder, &amp;quot;users&amp;quot;)
end
 
# Make visible for testing
ApplicationController.send(:public, :logged_in?, :current_user, :authorized?)&lt;/pre&gt;

&lt;p&gt;I’d have liked to put this in the support directory but Cucumber loaded it before env.rb, so I put in with the step_definitions.&lt;/p&gt;

&lt;p&gt;Once that was done, all that was left was to update authenticated_generator.rb to copy the template features instead of stories.&lt;/p&gt;

&lt;p&gt;The result is available from &lt;a href=&quot;http://github.com/bryan-ash/restful-authentication/tree&quot;&gt;my fork&lt;/a&gt; on github.&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/6710261044071847390/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/01/restful-authentication-with-cucumber_12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/6710261044071847390'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/6710261044071847390'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/01/restful-authentication-with-cucumber_12.html' title='Restful-Authentication with Cucumber features (Step 2)'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-3495749242750219434</id><published>2009-01-10T12:18:00.004-05:00</published><updated>2009-01-10T13:10:23.423-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bdd"/><category scheme="http://www.blogger.com/atom/ns#" term="cucumber"/><category scheme="http://www.blogger.com/atom/ns#" term="rails"/><title type='text'>Restful-Authentication with Cucumber features (Step 1)</title><content type='html'>My latest exercise is to update the &lt;a href=&quot;http://github.com/technoweenie/restful-authentication/tree&quot;&gt;restful-authentication&lt;/a&gt; Rails plugin to generate &lt;a href=&quot;http://github.com/aslakhellesoy/cucumber/tree&quot;&gt;Cucumber&lt;/a&gt; features instead of RSpec stories.

There is already a &lt;a href=&quot;http://rails_security.lighthouseapp.com/projects/15332/tickets/23-use-cucumber-features-instead-of-rspec-stories&quot;&gt;Lighthouse ticket&lt;/a&gt; open for this, so I guess I&#39;m not the first one to think of it.

The first steps make sure that restful-authentication is set up correctly:&lt;ol&gt;
&lt;li&gt;Create an empty Rails application&lt;/li&gt;&lt;li&gt;Put in version control (git init, git add ., git commit -a -m &quot;init&quot;)&lt;/li&gt;&lt;li&gt;Add plugins as shown on the Cucumber &lt;a href=&quot;http://wiki.github.com/aslakhellesoy/cucumber/ruby-on-rails&quot;&gt;Rails wiki page&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Add &lt;a href=&quot;http://github.com/bryan-ash/restful-authentication/tree&quot;&gt;my fork&lt;/a&gt; of restful-authentication in the same manner&lt;/li&gt;&lt;li&gt;Complete the restful-authentication installation per the directions&lt;/li&gt;&lt;li&gt;Create the database tables (rake db:migrate)&lt;/li&gt;&lt;li&gt;Run the RSpec stories (stories\rest_auth_stories.rb)&lt;/li&gt;&lt;/ol&gt;

Stories won&#39;t even run, let alone pass!  I&#39;m not going to show all the errors along the way, but the steps to get to passing stories were:&lt;ol&gt;&lt;li&gt;Added AthenticatedSystem into ApplicationController with the following 2 lines:&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;  include AuthenticatedSystem
  helper :all # include all helpers, all the time&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Uncommented the routes.rb map.root line(map.root :controller =&gt; &quot;welcome&quot;)&lt;/li&gt;&lt;li&gt;Removed line 1 of user_steps.rb (require File.dirname(__FILE__) + &#39;/../helper&#39;)&lt;/li&gt;&lt;li&gt;Created a minimal WelcomeController with an index method&lt;/li&gt;&lt;li&gt;Created a minimal layout&lt;/li&gt;&lt;/ol&gt;

&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;16 scenarios: 16 succeeded, 0 failed, 0 pending&lt;/pre&gt;

Hurrah!</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/3495749242750219434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2009/01/restful-authentication-with-cucumber.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/3495749242750219434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/3495749242750219434'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2009/01/restful-authentication-with-cucumber.html' title='Restful-Authentication with Cucumber features (Step 1)'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-3207913781298910741</id><published>2008-10-19T21:18:00.007-04:00</published><updated>2008-10-19T22:35:56.099-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bdd"/><category scheme="http://www.blogger.com/atom/ns#" term="cucumber"/><category scheme="http://www.blogger.com/atom/ns#" term="rails"/><category scheme="http://www.blogger.com/atom/ns#" term="webrat"/><title type='text'>Cucumber scenarios need a title</title><content type='html'>So I&#39;m playing with &lt;a href=&quot;http://dannorth.net/introducing-bdd&quot;&gt;Behavior Driven Development&lt;/a&gt; (BDD) and Ruby on Rails using &lt;a href=&quot;http://github.com/aslakhellesoy/cucumber/wikis/home&quot;&gt;Cucumber&lt;/a&gt; and &lt;a href=&quot;http://github.com/brynary/webrat&quot;&gt;Webrat&lt;/a&gt;.  I thought I&#39;d start with the simplest feature I could think of, &quot;I want to see the application name in the title&quot;. So, off we go with features/site_layout.feature:
&lt;pre name=&quot;code&quot; class=&quot;feature&quot;&gt;
Feature: Site Layout
  In order to build familiarity
  As a user
  I want to see the application name in the title

  Scenario:
    Given I am on the home page
    Then the title tag should be &quot;WOW App&quot;
&lt;/pre&gt;
I create features/steps/site_steps.rb:
&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;
Given /^I am on (.*)$/ do |page|
  visits case page
         when &quot;the home page&quot;
           &quot;/&quot;
         else
           raise &quot;Can&#39;t find mapping from \&quot;#{page}\&quot; to a path&quot;
         end
end

Then /^the (.*) tag should be &quot;(.*)&quot;$/ do |tag, content|
  response.should have_tag(tag, content)
end
&lt;/pre&gt;
And run it with &quot;rake features&quot;.  What I get is:
&lt;pre&gt;
C:\dev\temp&gt;rake features
(in C:/dev/temp)
Feature: Site Layout  # features/site_layout.feature
  In order to build familiarity
  As a user
  I want to see the application name in the title
  &lt;font color=&quot;green&quot;&gt;Scenario: Given I am on the home page&lt;/font&gt;     # features/site_layout.feature:6
    &lt;font color=&quot;red&quot;&gt;Then the title tag should be &quot;WOW App&quot;&lt;/font&gt;  # features/steps/site_steps.rb:10
      &lt;font color=&quot;red&quot;&gt;You have a nil object when you didn&#39;t expect it!
      The error occurred while evaluating nil.content_type (NoMethodError)
      ...
      ./features/steps/site_steps.rb:11:in `Then /^the (.*) tag should be &quot;(.*)&quot;$/&#39;
      features/site_layout.feature:8:in `Then the title tag should be &quot;WOW App&quot;&#39;


1 steps failed&lt;/font&gt;
rake aborted!
&lt;/pre&gt;
    
Not quite what I had in mind, I was expecting a failure, but got an error.  Nevermind, this is all very new to me, so I&#39;ll push on and it&#39;ll all become clear right?

I create an app/views/layouts/application.html.erb:
&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
       &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;

&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&amp;gt;
  &amp;lt;head&amp;gt;
  &amp;lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&amp;gt;
    &amp;lt;title&amp;gt;WOW App&amp;lt/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;

Run the feature again ... no joy, same error.  Hours of web searching leads me nowhere.  Finally while looking at some examples I noticed that my Scenario doesn&#39;t have a description, so I add one on line 6:

&lt;pre name=&quot;code&quot; class=&quot;feature&quot;&gt;
Feature: Site Layout
  In order to build familiarity
  As a user
  I want to see the application name in the title

  Scenario: On the home page
    Given I am on the home page
    Then the title tag should be &quot;WOW App&quot;
&lt;/pre&gt;

Now I get:

&lt;pre&gt;
C:\dev\temp&gt;rake features
(in C:/dev/temp)
Feature: Site Layout  # features/site_layout.feature
  In order to build familiarity
  As a user
  I want to see the application name in the title
  &lt;font color=&quot;green&quot;&gt;Scenario: On the home page&lt;/font&gt;                # features/site_layout.feature:6
    &lt;font color=&quot;red&quot;&gt;Given I am on the home page             # features/steps/site_steps.rb:1
      No route matches &quot;/&quot; with {:method=&gt;:get} (ActionController::RoutingError)
...
      features/site_layout.feature:7:in `Given I am on the home page&#39;&lt;/font&gt;
    &lt;font color=&quot;blue&quot;&gt;Then the title tag should be &quot;WOW App&quot;&lt;/font&gt;  # features/steps/site_steps.rb:10


&lt;font color=&quot;red&quot;&gt;1 steps failed&lt;/font&gt;
&lt;font color=&quot;blue&quot;&gt;1 steps skipped&lt;/font&gt;
rake aborted!
&lt;/pre&gt;

A quick addition to config/routes.rb:
&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;
map.root :controller =&gt; &#39;example&#39;
&lt;/pre&gt;

And a stub controller from &quot;ruby script\generate controller Example index&quot;, I get:

&lt;pre&gt;
C:\dev\temp&gt;rake features
(in C:/dev/temp)
Feature: Site Layout  # features/site_layout.feature
  In order to build familiarity
  As a user
  I want to see the application name in the title
  &lt;font color=&quot;green&quot;&gt;Scenario: On the home page&lt;/font&gt;                # features/site_layout.feature:6
    &lt;font color=&quot;green&quot;&gt;Given I am on the home page&lt;/font&gt;             # features/steps/site_steps.rb:1
    &lt;font color=&quot;green&quot;&gt;Then the title tag should be &quot;WOW App&quot;&lt;/font&gt;  # features/steps/site_steps.rb:10


&lt;font color=&quot;green&quot;&gt;2 steps passed&lt;/font&gt;
&lt;/pre&gt;

Hurrah!</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/3207913781298910741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2008/10/cucumber-scenarios-need-title.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/3207913781298910741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/3207913781298910741'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2008/10/cucumber-scenarios-need-title.html' title='Cucumber scenarios need a title'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-2266881832885991686</id><published>2008-10-05T21:21:00.003-04:00</published><updated>2008-10-05T23:01:20.515-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="sqlite3"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Where to put sqlite3.dll on Windows</title><content type='html'>When I first started using SQLite3 on Windows, most people suggested downloading sqlite3.dll from &lt;a href=&quot;http://www.sqlite.org/download.html&quot;&gt;www.sqlite.org&lt;/a&gt; and storing it in ruby/bin so Windows could find it.  For a while, this strategy worked fine but I really didn&#39;t like the application requiring users to put that DLL into an acceptable place.

I don&#39;t know why it didn&#39;t occur to me earlier, but, given that this is only intended to be a Windows application, why not just modify the PATH environment variable within the application.  So that&#39;s what I&#39;ve done.  In config/boot.rb:
&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;
# Make sqlite3.dll available
ENV[&#39;PATH&#39;] += &quot;;#{RAILS_ROOT}/vendor/bin/sqlite3&quot;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/2266881832885991686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2008/10/where-to-put-sqlite3dll-on-windows.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/2266881832885991686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/2266881832885991686'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2008/10/where-to-put-sqlite3dll-on-windows.html' title='Where to put sqlite3.dll on Windows'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-5447989134644827492</id><published>2008-10-02T13:08:00.008-04:00</published><updated>2009-01-12T07:43:40.382-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><title type='text'>class &lt;&lt; self</title><content type='html'>I&#39;ve come across this construct many times while browsing a number of open source projects:
&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;
class MyClass
  class &amp;lt&amp;lt self
    def a_class_method
      ...
    end
  end

  def an_instance_method
    ...
  end
end
&lt;/pre&gt;
I finally got it today ... there&#39;s no black magic ... all &quot;class &amp;lt&amp;lt self&quot; means is:
&lt;blockquote&gt;add the following class method definitions to the class MyClass.&lt;/blockquote&gt; 
Or,
&lt;blockquote&gt;open the class MyClass, and add the following class methods.&lt;/blockquote&gt;
Now that I&#39;m in the gang and understand this incantation, I&#39;m not sure I like it.  It seems like a nice way to group all your class methods together, but if you define several class methods then it becomes harder to recognize whether a method belongs to the class or an instance.  I think it&#39;s cleaner to explicitly state the ownership of each method:
&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;
class MyClass
  def self.a_class_method
    ...
  end

  def an_instance_method
    ...
  end
end
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/5447989134644827492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2008/10/class-self.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/5447989134644827492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/5447989134644827492'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2008/10/class-self.html' title='class &lt;&lt; self'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-4988991560115295832</id><published>2008-09-20T22:46:00.012-04:00</published><updated>2009-01-19T20:27:27.938-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="rails"/><category scheme="http://www.blogger.com/atom/ns#" term="test"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>My first Rails bug</title><content type='html'>&lt;p&gt;&lt;em&gt;UPDATE January 14, 2009 -&amp;gt; &lt;a href=&quot;http://bryan-ash.blogspot.com/2009/01/my-first-rails-bug-accepted.html&quot;&gt;The patch for this bug was accepted!&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;I&#39;m pretty new to &lt;a href=&quot;http://rubyonrails.org/&quot;&gt;Rails&lt;/a&gt; and my first project included uploading videos. Shouldn&#39;t be too difficult I thought, after a little Google searching, I came up with the perfect example by Jim Neath: &lt;a title=&quot;Permanent Link: Converting Videos with Rails: Converting the Video&quot; href=&quot;http://jimneath.org/2008/06/03/converting-videos-with-rails-converting-the-video/&quot; rel=&quot;bookmark&quot;&gt;Converting Videos with Rails: Converting the Video&lt;/a&gt; Wanting to practice new skills with &lt;a href=&quot;http://rspec.info/&quot;&gt;RSpec&lt;/a&gt; and &lt;a href=&quot;https://github.com/aslakhellesoy/cucumber/tree&quot;&gt;Cucumber&lt;/a&gt; I wrote my first feature spec: &lt;/p&gt;  &lt;pre class=&quot;cucumber&quot; name=&quot;code&quot;&gt;Feature: Upload videos
  In order to provide videos to users after hours
  As a videographer
  I want to upload videos

  Scenario: A valid filename is provided
    Given I go to the new video page
    And I browse to the file &amp;quot;Movie_0001.avi&amp;quot;

    When I submit the upload

    Then I should see &amp;quot;success&amp;quot;
    And the file should be uploaded&lt;/pre&gt;
and the supporting steps file, upload_steps.rb: 

&lt;pre class=&quot;ruby&quot; name=&quot;code&quot;&gt;require &#39;ftools&#39;
require &#39;mime/types&#39;

When /I browse to the file \&amp;quot;(.+)\&amp;quot;/ do |path|
  @original_filepath = File.join(&#39;features/fixtures/&#39;, path)
  mime_types = MIME::Types.of(@original_filepath)

  attach_file &#39;video[source]&#39;, @original_filepath, mime_types[0].content_type
end

When &#39;I submit the upload&#39; do
  click_button &#39;Create&#39;
end

def uploaded_filepath
  uploaded_basename = File.basename(@original_filepath)
  File.join(RAILS_ROOT, &amp;quot;public/videos/1&amp;quot;, uploaded_basename)
end

Then /the file should be uploaded/ do
  assert File.compare(@original_filepath, uploaded_filepath)
end&lt;/pre&gt;
what I got was: 

&lt;pre&gt;...
    &lt;font color=&quot;red&quot;&gt;And the file should be uploaded
      &lt;false&gt; is not true. (Test::Unit::AssertionFailedError)
      c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:48:in `assert_block&#39;
      c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:500:in `_wrap_assertion&#39;
      c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:46:in `assert_block&#39;
      c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:63:in `assert&#39;
      c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:495:in `_wrap_assertion&#39;
      c:/ruby/lib/ruby/1.8/test/unit/assertions.rb:61:in `assert&#39;
      ./features/upload/steps/upload_steps.rb:22:in `And /the file should be uploaded/&#39;
      features/upload/upload.feature:14:in `And the file should be uploaded&#39;&lt;/font&gt;
...&lt;/pre&gt;
On closer inspection, the test was failing because the uploaded file was truncated in some bizarre way. However, if I ran the application and manually upload a file from the browser, everything worked fine. After much hunting I ended up in rails/actionpack/lib/action_controller/integration.rb where in multipart_body, the mode is not specified in the call to File.open, so it defaults to &amp;quot;r&amp;quot;. This is all well and good on anything but Windows, which I happen to be using! Windows requires that the mode be specified as &amp;quot;rb&amp;quot; to ensure the file is read as binary. I submitted a &lt;a href=&quot;http://rails.lighthouseapp.com/projects/8994/tickets/1065-multipart_body-truncates-file-in-windows&quot;&gt;patch&lt;/a&gt; but I&#39;m not holding my breath for it to be pulled in anytime soon.

  </content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/4988991560115295832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2008/09/my-first-rails-bug.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/4988991560115295832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/4988991560115295832'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2008/09/my-first-rails-bug.html' title='My first Rails bug'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-4951581263601731269</id><published>2008-09-20T20:34:00.001-04:00</published><updated>2008-10-05T21:13:23.137-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="embedded"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="test"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Ruby PCAN DLL Wrapper</title><content type='html'>Inspired by &lt;a href=&quot;http://www.atomicobject.com/pages/System+Testing+in+Ruby&quot;&gt;System Testing In Ruby (Systir)&lt;/a&gt;, I have published a small Ruby &lt;a href=&quot;http://rubyforge.org/projects/pcanusb/&quot;&gt;PCAN USB DLL Wrapper.&lt;/a&gt;

Now with a small &lt;a href=&quot;http://www.peak-system.com/db/gb/pcanusb_gb.html&quot;&gt;device&lt;/a&gt; available for less than $300 and some free software, I can write automated system test scripts of the form:
&lt;blockquote&gt;send tftp_rrq(&quot;autoexec.bat&quot;).with(blksize(2036))
verify_target_sends oack(blksize(2036)

send ack(0)
verify_target_sends autoexec_bat
send ack(1)
&lt;/blockquote&gt;If you have &lt;a href=&quot;http://rubygems.org/&quot;&gt;rubygems&lt;/a&gt; installed, PCAN DLL Wrapper is easily obtained:
&lt;blockquote&gt;set http_proxy=http://my_proxy_host.com:80
gem install pcanusb
&lt;/blockquote&gt;and then use:
&lt;blockquote&gt;require &#39;pcan_usb&#39;

PCAN_USB.init(PCAN_USB::BAUD_1M)
PCAN_USB.write(0x0E100501, &quot;Hello World!&quot;)
PCAN_USB.close
&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/4951581263601731269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2008/09/ruby-pcan-dll-wrapper_20.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/4951581263601731269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/4951581263601731269'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2008/09/ruby-pcan-dll-wrapper_20.html' title='Ruby PCAN DLL Wrapper'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-4227048963961034066</id><published>2008-09-20T20:29:00.000-04:00</published><updated>2008-09-20T20:30:04.621-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="quotes"/><title type='text'>Collection o quotes</title><content type='html'>Ricky Hustler, a friend of mine, used to use this one on a regular basis:&lt;b&gt;
&lt;/b&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&lt;blockquote&gt;&quot;You never see a luggage rack on a hearse&quot;
&lt;/blockquote&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;
&lt;/span&gt;&lt;/b&gt;I came across this on &lt;a href=&quot;http://butunclebob.com/ArticleS.JamesGrenning&quot;&gt;James Grenning&#39;s&lt;/a&gt; blog:&lt;b&gt;
&lt;/b&gt;&lt;blockquote&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&quot;It&#39;s easier to act your way into thinking differently than to think your way into acting differently&quot;&lt;/span&gt;
&lt;/blockquote&gt;&lt;span&gt;
From a friend&#39;s coffee cup:
&lt;blockquote&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&quot;Lead, follow, or get out of my way&quot;&lt;/span&gt;
&lt;/blockquote&gt;
&lt;a href=&quot;http://www.susanjeffers.com/&quot;&gt;Susan Jeffers&lt;/a&gt;:
&lt;blockquote&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;&quot;Feel the fear and do it anyway&quot;
&lt;/span&gt;&lt;/blockquote&gt;
&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/4227048963961034066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2008/09/collection-o-quotes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/4227048963961034066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/4227048963961034066'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2008/09/collection-o-quotes.html' title='Collection o quotes'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1151397178864889664.post-6408874248421443008</id><published>2008-06-10T20:40:00.004-04:00</published><updated>2008-10-05T21:13:46.423-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>ActiveRecord requires RAILS_ROOT for relative Sqlite path</title><content type='html'>I&#39;m writing a little time tracking tool for Windows in Ruby. The data is stored in a database so I figured I&#39;d use ActiveRecord and maybe learn something about Rails along the way. Everything I found about ActiveRecord tells me that it &quot;can be used independently outside of &lt;a href=&quot;http://api.rubyonrails.org/classes/Rails.html&quot;&gt;Rails&lt;/a&gt;&quot;.  One minor detail that I just figured out:
&lt;blockquote&gt;If you want to use a relative path for a sqlite3 database in your database.yml, you have to define RAILS_ROOT.
&lt;/blockquote&gt;For example, if config/database.yml =&gt;
&lt;pre name=&quot;code&quot; class=&quot;yaml&quot;&gt;
production:
  adapter: sqlite3
  database: db/production.sqlite
&lt;/pre&gt;
ActiveRecord initialization (mine&#39;s in config/boot.rb) looks like:
&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;
RAILS_ROOT = &quot;#{File.dirname(File.expand_path(__FILE__))}/..&quot;
RAILS_ENV  = ENV[&#39;RAILS_ENV&#39;] || &#39;production&#39;

$LOAD_PATH.unshift &quot;#{RAILS_ROOT}/vendor/sqlite3&quot;
config = YAML::load(IO.read(&quot;#{RAILS_ROOT}/config/database.yml&quot;))
ActiveRecord::Base.configurations = config
ActiveRecord::Base.establish_connection(config[RAILS_ENV])
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://bryan-ash.blogspot.com/feeds/6408874248421443008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bryan-ash.blogspot.com/2008/06/activerecord-requires-railsroot-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/6408874248421443008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1151397178864889664/posts/default/6408874248421443008'/><link rel='alternate' type='text/html' href='http://bryan-ash.blogspot.com/2008/06/activerecord-requires-railsroot-for.html' title='ActiveRecord requires RAILS_ROOT for relative Sqlite path'/><author><name>Bryan Ash</name><uri>http://www.blogger.com/profile/16035145599734362152</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnLZS8g3W5kUMZan5nIEwBwypUD91A8hgqOAvme1rRR6TIt8HLJRbiwVHZI76P3QdSGNXpffZ6OKgb57fEUjPa10qoh-zsQv2zRg0IfKPkuAhApTMVUoBlfEtfzl5KXA/s1600-r/48d30b5cea7a69195e9082da5e0b9ff8.jpg'/></author><thr:total>0</thr:total></entry></feed>