Permalink
Browse files

Use smartypants filtering to keep @tomstuart happy

  • Loading branch information...
1 parent 59d3c67 commit 27bc141ebb798a93d21bd214f09efe0732eda50c @tomafro committed Nov 11, 2012
Showing with 862 additions and 859 deletions.
  1. +1 −0 Gemfile
  2. +2 −0 Gemfile.lock
  3. +1 −1 lib/lanyon/filters.rb
  4. +13 −13 public/2009/05.html
  5. +1 −1 public/2009/05/adam-sandersons-open-gem.html
  6. +2 −2 public/2009/05/an-objective-c-implementation-of-active-supports-inflector.html
  7. +4 −4 public/2009/05/automatching-rails-paths-in-cucumber.html
  8. +1 −1 public/2009/05/imitation-is-the-sincerest-form-of-flattery.html
  9. +3 −3 public/2009/05/read-active-record-columns-directly-from-the-class.html
  10. +2 −2 public/2009/05/using-rack-middleware-for-good-and-evil.html
  11. +3 −3 public/2009/06.html
  12. +3 −3 public/2009/06/pimp-my-script-console.html
  13. +3 −3 public/2009/07.html
  14. +3 −3 public/2009/07/dscl-the-easy-way-to-add-hosts-on-osx.html
  15. +33 −33 public/2009/08.html
  16. +3 −3 public/2009/08/kernel-specific-zsh-dotfiles.html
  17. +3 −3 public/2009/08/the-cost-of-explicit-returns-in-ruby.html
  18. +1 −1 public/2009/08/tip-create-and-move-to-directory.html
  19. +1 −1 public/2009/08/tip-move-to-directory-and-open-in-textmate.html
  20. +11 −11 public/2009/08/using-indexes-in-rails-choosing-additional-indexes.html
  21. +11 −11 public/2009/08/using-indexes-in-rails-index-your-associations.html
  22. +3 −3 public/2009/08/zsh-completion-for-gem-and-gem-open.html
  23. +8 −8 public/2009/09.html
  24. +3 −3 public/2009/09/quickly-list-missing-foreign-key-indexes.html
  25. +5 −5 public/2009/09/tip-the-case-for-from-param.html
  26. +2 −2 public/2009/10.html
  27. +2 −2 public/2009/10/tip-cdpath-am-i-the-last-to-know.html
  28. +12 −12 public/2009/11.html
  29. +7 −7 public/2009/11/a-rails-template-for-gem-bundler.html
  30. +4 −4 public/2009/11/building-gems-from-a-rails-branch.html
  31. +1 −1 public/2009/11/taking-screenshots-of-web-pages-with-macruby.html
  32. +5 −5 public/2010/01.html
  33. +2 −2 public/2010/01/how-to-use-rails3-gems-now.html
  34. +3 −3 public/2010/01/tip-relative-paths-with-file-expand-path.html
  35. +9 −9 public/2010/02.html
  36. +4 −4 public/2010/02/rails-3-direct-column-reader.html
  37. +5 −5 public/2010/02/updated-rails-template-for-bundler.html
  38. +5 −5 public/2011/02.html
  39. +3 −3 public/2011/02/experimental-mongo-instrumentation.html
  40. +1 −1 public/2011/02/rails-3-column-reader-tweak.html
  41. +1 −1 public/2011/02/rails-mongo-instrumentation-gem.html
  42. +4 −4 public/2011/03.html
  43. +4 −4 public/2011/03/hashblue-opens-for-business.html
  44. +7 −7 public/2011/08.html
  45. +7 −7 public/2011/08/presenting-the-hashblue-api.html
  46. +9 −9 public/2011/09.html
  47. +4 −4 public/2011/09/a-small-toy-to-explore-geohashes.html
  48. +1 −1 public/2011/09/geohash-toy-code-released.html
  49. +4 −4 public/2011/09/tip-automatic-bundle-exec-for-rake-and-more.html
  50. +4 −4 public/2012/02.html
  51. +4 −4 public/2012/02/working-inside-government.html
  52. +5 −5 public/2012/06.html
  53. +5 −5 public/2012/06/tip-bundler-with-binstubs.html
  54. +1 −1 public/404.html
  55. +3 −3 public/about.html
  56. +35 −35 public/atom.xml
  57. +25 −25 public/index.html
  58. +13 −13 public/tags/active-record.html
  59. +2 −2 public/tags/active-support.html
  60. +7 −7 public/tags/api.html
  61. +5 −5 public/tags/app.html
  62. +25 −25 public/tags/bundler.html
  63. +2 −2 public/tags/cdpath.html
  64. +4 −4 public/tags/code.html
  65. +8 −8 public/tags/column-reader.html
  66. +3 −3 public/tags/completion.html
  67. +4 −4 public/tags/cucumber.html
  68. +25 −25 public/tags/databases.html
  69. +1 −1 public/tags/design.html
  70. +3 −3 public/tags/development.html
  71. +3 −3 public/tags/dscl.html
  72. +2 −2 public/tags/evil.html
  73. +3 −3 public/tags/expand-path.html
  74. +3 −3 public/tags/file.html
  75. +4 −4 public/tags/freerange.html
  76. +5 −5 public/tags/from-param.html
  77. +2 −2 public/tags/fun.html
  78. +4 −4 public/tags/gds.html
  79. +4 −4 public/tags/gem-open.html
  80. +29 −29 public/tags/gem.html
  81. +2 −2 public/tags/gems.html
  82. +5 −5 public/tags/geohash.html
  83. +1 −1 public/tags/github.html
  84. +11 −11 public/tags/gofreerange.html
  85. +4 −4 public/tags/government.html
  86. +11 −11 public/tags/hashblue.html
  87. +1 −1 public/tags/imitation.html
  88. +25 −25 public/tags/indexes.html
  89. +2 −2 public/tags/inflector.html
  90. +4 −4 public/tags/instrumentation.html
  91. +3 −3 public/tags/irb.html
  92. +3 −3 public/tags/linux.html
  93. +1 −1 public/tags/macruby.html
  94. +1 −1 public/tags/meta.html
  95. +3 −3 public/tags/micro-benchmark.html
  96. +2 −2 public/tags/middleware.html
  97. +4 −4 public/tags/mongo.html
  98. +11 −11 public/tags/o2.html
  99. +2 −2 public/tags/objective-c.html
  100. +8 −8 public/tags/osx.html
  101. +1 −1 public/tags/peepcode.html
  102. +2 −2 public/tags/rack.html
  103. +74 −74 public/tags/rails.html
  104. +11 −11 public/tags/rails3.html
  105. +9 −9 public/tags/rake.html
  106. +3 −3 public/tags/reminder.html
  107. +3 −3 public/tags/return.html
  108. +60 −60 public/tags/ruby.html
  109. +1 −1 public/tags/screenshots.html
  110. +3 −3 public/tags/shell.html
  111. +25 −25 public/tags/sql.html
  112. +2 −2 public/tags/terminal.html
  113. +4 −4 public/tags/testing.html
  114. +1 −1 public/tags/textmate.html
  115. +8 −8 public/tags/tiny.html
  116. +32 −32 public/tags/tip.html
  117. +5 −5 public/tags/toy.html
  118. +22 −22 public/tags/using-indexes-in-rails.html
  119. +1 −1 public/tags/web.html
  120. +4 −4 public/tags/whitehall.html
  121. +14 −14 public/tags/zsh.html
View
@@ -3,3 +3,4 @@ source :rubygems
gemspec
gem 'recap', '~> 1.0.0'
+gem 'rack'
View
@@ -38,6 +38,7 @@ GEM
open4 (1.3.0)
pygments.rb (0.2.12)
rubypython (~> 0.5.3)
+ rack (1.4.1)
rdiscount (1.6.8)
recap (1.0.2)
capistrano (~> 2.9.0)
@@ -62,4 +63,5 @@ PLATFORMS
DEPENDENCIES
lanyon!
+ rack
recap (~> 1.0.0)
View
@@ -24,7 +24,7 @@ def sql(text)
end
def markdown(text)
- RDiscount.new(render(text)).to_html
+ RDiscount.new(render(text), :smart).to_html
end
def youtube(video)
View
@@ -41,7 +41,7 @@
<h1><a href="/2009/05/read-active-record-columns-directly-from-the-class">Read ActiveRecord columns directly from the class</a></h1>
</header>
<div class="content">
- <p>Sometimes you want to read just a single column from a collection of records, without the overhead of instantiating each and every one. You could just execute raw SQL, but it's a shame to do away with the nice type conversion <code>ActiveRecord</code> provides. It'd also be a pity to get rid of find scoping, amongst other goodness.</p>
+ <p>Sometimes you want to read just a single column from a collection of records, without the overhead of instantiating each and every one. You could just execute raw SQL, but it&rsquo;s a shame to do away with the nice type conversion <code>ActiveRecord</code> provides. It&rsquo;d also be a pity to get rid of find scoping, amongst other goodness.</p>
<p>Enter <code>Tomafro::ColumnReader</code>:</p>
@@ -65,7 +65,7 @@
</div>
-<p>Once you've extended <code>ActiveRecord::Base</code> with it, usage is simple. In your models, declare which columns you want access to:</p>
+<p>Once you&rsquo;ve extended <code>ActiveRecord::Base</code> with it, usage is simple. In your models, declare which columns you want access to:</p>
<div class="highlight"><pre><span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span><span class="o">.</span><span class="n">extend</span> <span class="no">Tomafro</span><span class="o">::</span><span class="no">ColumnReader</span>
@@ -79,7 +79,7 @@
</div>
-<p>Once you've done this, you can access values directly from the class, respecting scope, limits and other finder options.</p>
+<p>Once you&rsquo;ve done this, you can access values directly from the class, respecting scope, limits and other finder options.</p>
<div class="highlight"><pre><span class="no">Animal</span><span class="o">.</span><span class="n">names</span>
<span class="c1">#=&gt; [&#39;Lion&#39;, &#39;Tiger&#39;, &#39;Zebra&#39;, &#39;Gazelle&#39;]</span>
@@ -113,9 +113,9 @@
<h1><a href="/2009/05/an-objective-c-implementation-of-active-supports-inflector">An Objective-C implementation of ActiveSupport's Inflector</a></h1>
</header>
<div class="content">
- <p>Over the last week I've been playing with Objective-C, for fun rather than profit. Here's the first result of this dabbling - <a href="http://github.com/tomafro/ActiveSupportInflector/tree/master">an Objective-C implementation</a> of ActiveSupport's pluralize and singularize methods.</p>
+ <p>Over the last week I&rsquo;ve been playing with Objective-C, for fun rather than profit. Here&rsquo;s the first result of this dabbling &ndash; <a href="http://github.com/tomafro/ActiveSupportInflector/tree/master">an Objective-C implementation</a> of ActiveSupport&rsquo;s pluralize and singularize methods.</p>
-<p>It's my first piece of code in the language, so I'd appreciate comments and feedback.</p>
+<p>It&rsquo;s my first piece of code in the language, so I&rsquo;d appreciate comments and feedback.</p>
</div>
<footer>
@@ -160,7 +160,7 @@
<div class="content">
<p>So we all know that <a href="http://rack.rubyforge.org/">Rack</a> is awesome, and that we can use Rack::Middleware for all sorts of things: <a href="http://github.com/brynary/rack-bug/tree/master">debugging</a>, <a href="http://tomayko.com/src/rack-cache/">caching</a> and a <a href="http://github.com/rack/rack-contrib/tree/master">whole host more</a>.</p>
-<p>What all these have in common (apart from maybe <a href="http://github.com/rack/rack-contrib/blob/8b6323c8eecc8279088987c52b27dda5d4cadf7b/lib/rack/contrib/evil.rb">Rack::Evil</a>) is that they're all helpful. They all make writing Rack applications easier. Not my Middleware though.</p>
+<p>What all these have in common (apart from maybe <a href="http://github.com/rack/rack-contrib/blob/8b6323c8eecc8279088987c52b27dda5d4cadf7b/lib/rack/contrib/evil.rb">Rack::Evil</a>) is that they&rsquo;re all helpful. They all make writing Rack applications easier. Not my Middleware though.</p>
<h3>Introducing Rack::Shuffler</h3>
@@ -183,7 +183,7 @@
</div>
-<p>I suggest you add it to a colleague's app late on a Friday afternoon, and see how long it takes to drive them to insanity.</p>
+<p>I suggest you add it to a colleague&rsquo;s app late on a Friday afternoon, and see how long it takes to drive them to insanity.</p>
</div>
<footer>
@@ -203,7 +203,7 @@
<h1><a href="/2009/05/imitation-is-the-sincerest-form-of-flattery">If imitation is the sincerest form of flattery...</a></h1>
</header>
<div class="content">
- <p><a href="http://www.tiagoluchini.eu/">...consider me flattered</a>.</p>
+ <p><a href="http://www.tiagoluchini.eu/">&hellip;consider me flattered</a>.</p>
</div>
<footer>
@@ -221,7 +221,7 @@
<h1><a href="/2009/05/automatching-rails-paths-in-cucumber">Automatching rails paths in cucumber</a></h1>
</header>
<div class="content">
- <p>If you're using <a href="http://cukes.info/">cucumber</a> as part of your testing, you probably have a <code>paths.rb</code> file that looks something like this:</p>
+ <p>If you&rsquo;re using <a href="http://cukes.info/">cucumber</a> as part of your testing, you probably have a <code>paths.rb</code> file that looks something like this:</p>
<div class="highlight"><pre><span class="k">module</span> <span class="nn">NavigationHelpers</span>
<span class="k">def</span> <span class="nf">path_to</span><span class="p">(</span><span class="n">page_name</span><span class="p">)</span>
@@ -246,9 +246,9 @@
</div>
-<p>This let's us use nice descriptive names in our scenarios, but it starts to become a pain when we add more and more paths. So how can we make it better?</p>
+<p>This let&rsquo;s us use nice descriptive names in our scenarios, but it starts to become a pain when we add more and more paths. So how can we make it better?</p>
-<p>By automatically matching some rails paths. Here's the code:</p>
+<p>By automatically matching some rails paths. Here&rsquo;s the code:</p>
<div class="highlight"><pre><span class="k">module</span> <span class="nn">NavigationHelpers</span>
<span class="k">def</span> <span class="nf">path_to</span><span class="p">(</span><span class="n">page_name</span><span class="p">)</span>
@@ -281,7 +281,7 @@
<p>What it does is pretty simple. Given a page name <code>the clients page</code> (with no other matches defined) it will try and send <code>clients_path</code>. If successful, then it returns the result, otherwise nil.</p>
-<p>Not the biggest improvement in the world, but it's made my cucumber tests just a little bit easier to write.</p>
+<p>Not the biggest improvement in the world, but it&rsquo;s made my cucumber tests just a little bit easier to write.</p>
</div>
<footer>
@@ -335,7 +335,7 @@
</div>
-<p>If you're running on OS X and use TextMate, you may have already set <code>$EDITOR</code> to <code>mate -w</code>, which let's you use TextMate as the editor for git commit messages and much more. However, the <code>-w</code> flag doesn't work with open_gem, so set the <code>$GEM_OPEN_EDITOR</code> variable, and open_gem will use that instead:</p>
+<p>If you&rsquo;re running on OS X and use TextMate, you may have already set <code>$EDITOR</code> to <code>mate -w</code>, which let&rsquo;s you use TextMate as the editor for git commit messages and much more. However, the <code>-w</code> flag doesn&rsquo;t work with open_gem, so set the <code>$GEM_OPEN_EDITOR</code> variable, and open_gem will use that instead:</p>
<div class="highlight"><pre><span class="nv">$ </span><span class="nb">export </span><span class="nv">GEM_OPEN_EDITOR</span><span class="o">=</span>mate
</pre>
@@ -75,7 +75,7 @@
</div>
-<p>If you're running on OS X and use TextMate, you may have already set <code>$EDITOR</code> to <code>mate -w</code>, which let's you use TextMate as the editor for git commit messages and much more. However, the <code>-w</code> flag doesn't work with open_gem, so set the <code>$GEM_OPEN_EDITOR</code> variable, and open_gem will use that instead:</p>
+<p>If you&rsquo;re running on OS X and use TextMate, you may have already set <code>$EDITOR</code> to <code>mate -w</code>, which let&rsquo;s you use TextMate as the editor for git commit messages and much more. However, the <code>-w</code> flag doesn&rsquo;t work with open_gem, so set the <code>$GEM_OPEN_EDITOR</code> variable, and open_gem will use that instead:</p>
<div class="highlight"><pre><span class="nv">$ </span><span class="nb">export </span><span class="nv">GEM_OPEN_EDITOR</span><span class="o">=</span>mate
</pre>
@@ -41,9 +41,9 @@
<h1><a href="/2009/05/an-objective-c-implementation-of-active-supports-inflector">An Objective-C implementation of ActiveSupport's Inflector</a></h1>
</header>
<div class="content">
- <p>Over the last week I've been playing with Objective-C, for fun rather than profit. Here's the first result of this dabbling - <a href="http://github.com/tomafro/ActiveSupportInflector/tree/master">an Objective-C implementation</a> of ActiveSupport's pluralize and singularize methods.</p>
+ <p>Over the last week I&rsquo;ve been playing with Objective-C, for fun rather than profit. Here&rsquo;s the first result of this dabbling &ndash; <a href="http://github.com/tomafro/ActiveSupportInflector/tree/master">an Objective-C implementation</a> of ActiveSupport&rsquo;s pluralize and singularize methods.</p>
-<p>It's my first piece of code in the language, so I'd appreciate comments and feedback.</p>
+<p>It&rsquo;s my first piece of code in the language, so I&rsquo;d appreciate comments and feedback.</p>
</div>
<footer>
@@ -41,7 +41,7 @@
<h1><a href="/2009/05/automatching-rails-paths-in-cucumber">Automatching rails paths in cucumber</a></h1>
</header>
<div class="content">
- <p>If you're using <a href="http://cukes.info/">cucumber</a> as part of your testing, you probably have a <code>paths.rb</code> file that looks something like this:</p>
+ <p>If you&rsquo;re using <a href="http://cukes.info/">cucumber</a> as part of your testing, you probably have a <code>paths.rb</code> file that looks something like this:</p>
<div class="highlight"><pre><span class="k">module</span> <span class="nn">NavigationHelpers</span>
<span class="k">def</span> <span class="nf">path_to</span><span class="p">(</span><span class="n">page_name</span><span class="p">)</span>
@@ -66,9 +66,9 @@
</div>
-<p>This let's us use nice descriptive names in our scenarios, but it starts to become a pain when we add more and more paths. So how can we make it better?</p>
+<p>This let&rsquo;s us use nice descriptive names in our scenarios, but it starts to become a pain when we add more and more paths. So how can we make it better?</p>
-<p>By automatically matching some rails paths. Here's the code:</p>
+<p>By automatically matching some rails paths. Here&rsquo;s the code:</p>
<div class="highlight"><pre><span class="k">module</span> <span class="nn">NavigationHelpers</span>
<span class="k">def</span> <span class="nf">path_to</span><span class="p">(</span><span class="n">page_name</span><span class="p">)</span>
@@ -101,7 +101,7 @@
<p>What it does is pretty simple. Given a page name <code>the clients page</code> (with no other matches defined) it will try and send <code>clients_path</code>. If successful, then it returns the result, otherwise nil.</p>
-<p>Not the biggest improvement in the world, but it's made my cucumber tests just a little bit easier to write.</p>
+<p>Not the biggest improvement in the world, but it&rsquo;s made my cucumber tests just a little bit easier to write.</p>
</div>
<footer>
@@ -41,7 +41,7 @@
<h1><a href="/2009/05/imitation-is-the-sincerest-form-of-flattery">If imitation is the sincerest form of flattery...</a></h1>
</header>
<div class="content">
- <p><a href="http://www.tiagoluchini.eu/">...consider me flattered</a>.</p>
+ <p><a href="http://www.tiagoluchini.eu/">&hellip;consider me flattered</a>.</p>
</div>
<footer>
@@ -41,7 +41,7 @@
<h1><a href="/2009/05/read-active-record-columns-directly-from-the-class">Read ActiveRecord columns directly from the class</a></h1>
</header>
<div class="content">
- <p>Sometimes you want to read just a single column from a collection of records, without the overhead of instantiating each and every one. You could just execute raw SQL, but it's a shame to do away with the nice type conversion <code>ActiveRecord</code> provides. It'd also be a pity to get rid of find scoping, amongst other goodness.</p>
+ <p>Sometimes you want to read just a single column from a collection of records, without the overhead of instantiating each and every one. You could just execute raw SQL, but it&rsquo;s a shame to do away with the nice type conversion <code>ActiveRecord</code> provides. It&rsquo;d also be a pity to get rid of find scoping, amongst other goodness.</p>
<p>Enter <code>Tomafro::ColumnReader</code>:</p>
@@ -65,7 +65,7 @@
</div>
-<p>Once you've extended <code>ActiveRecord::Base</code> with it, usage is simple. In your models, declare which columns you want access to:</p>
+<p>Once you&rsquo;ve extended <code>ActiveRecord::Base</code> with it, usage is simple. In your models, declare which columns you want access to:</p>
<div class="highlight"><pre><span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span><span class="o">.</span><span class="n">extend</span> <span class="no">Tomafro</span><span class="o">::</span><span class="no">ColumnReader</span>
@@ -79,7 +79,7 @@
</div>
-<p>Once you've done this, you can access values directly from the class, respecting scope, limits and other finder options.</p>
+<p>Once you&rsquo;ve done this, you can access values directly from the class, respecting scope, limits and other finder options.</p>
<div class="highlight"><pre><span class="no">Animal</span><span class="o">.</span><span class="n">names</span>
<span class="c1">#=&gt; [&#39;Lion&#39;, &#39;Tiger&#39;, &#39;Zebra&#39;, &#39;Gazelle&#39;]</span>
@@ -43,7 +43,7 @@
<div class="content">
<p>So we all know that <a href="http://rack.rubyforge.org/">Rack</a> is awesome, and that we can use Rack::Middleware for all sorts of things: <a href="http://github.com/brynary/rack-bug/tree/master">debugging</a>, <a href="http://tomayko.com/src/rack-cache/">caching</a> and a <a href="http://github.com/rack/rack-contrib/tree/master">whole host more</a>.</p>
-<p>What all these have in common (apart from maybe <a href="http://github.com/rack/rack-contrib/blob/8b6323c8eecc8279088987c52b27dda5d4cadf7b/lib/rack/contrib/evil.rb">Rack::Evil</a>) is that they're all helpful. They all make writing Rack applications easier. Not my Middleware though.</p>
+<p>What all these have in common (apart from maybe <a href="http://github.com/rack/rack-contrib/blob/8b6323c8eecc8279088987c52b27dda5d4cadf7b/lib/rack/contrib/evil.rb">Rack::Evil</a>) is that they&rsquo;re all helpful. They all make writing Rack applications easier. Not my Middleware though.</p>
<h3>Introducing Rack::Shuffler</h3>
@@ -66,7 +66,7 @@
</div>
-<p>I suggest you add it to a colleague's app late on a Friday afternoon, and see how long it takes to drive them to insanity.</p>
+<p>I suggest you add it to a colleague&rsquo;s app late on a Friday afternoon, and see how long it takes to drive them to insanity.</p>
</div>
<footer>
View
@@ -41,9 +41,9 @@
<h1><a href="/2009/06/pimp-my-script-console">Pimp my script/console</a></h1>
</header>
<div class="content">
- <p>For a long time I've had <a href="http://github.com/tomafro/dotfiles/blob/master/dotfiles/irbrc">an .irbrc file</a> and a <a href="http://github.com/tomafro/dotfiles/blob/master/dotfiles/railsrc">.railsrc file</a>, setting up some simple helpers methods in my <code>irb</code> and <code>script/console</code> sessions. Today though, I wanted to add some more helpers specific to the project I'm working on. Specifically, I wanted to be able to use my <a href="http://github.com/notahat/machinist/tree/master">machinist</a> blueprints, to help me play around with some models.</p>
+ <p>For a long time I&rsquo;ve had <a href="http://github.com/tomafro/dotfiles/blob/master/dotfiles/irbrc">an .irbrc file</a> and a <a href="http://github.com/tomafro/dotfiles/blob/master/dotfiles/railsrc">.railsrc file</a>, setting up some simple helpers methods in my <code>irb</code> and <code>script/console</code> sessions. Today though, I wanted to add some more helpers specific to the project I&rsquo;m working on. Specifically, I wanted to be able to use my <a href="http://github.com/notahat/machinist/tree/master">machinist</a> blueprints, to help me play around with some models.</p>
-<p>Adding <a href="http://github.com/notahat/machinist/tree/master">machinist</a> isn't as simple as just requiring my blueprints though -- they require my ActiveRecord models, which aren't available when <code>.irbrc</code> is loaded. Luckily the solution is simple -- just add a couple of lines to the configuration in environment.rb:</p>
+<p>Adding <a href="http://github.com/notahat/machinist/tree/master">machinist</a> isn&rsquo;t as simple as just requiring my blueprints though &mdash; they require my ActiveRecord models, which aren&rsquo;t available when <code>.irbrc</code> is loaded. Luckily the solution is simple &mdash; just add a couple of lines to the configuration in environment.rb:</p>
<div class="highlight"><pre><span class="no">Rails</span><span class="o">::</span><span class="no">Initializer</span><span class="o">.</span><span class="n">run</span> <span class="k">do</span> <span class="o">|</span><span class="n">config</span><span class="o">|</span>
<span class="k">if</span> <span class="n">defined?</span><span class="p">(</span><span class="no">IRB</span><span class="p">)</span>
@@ -56,7 +56,7 @@
</div>
-<p>The key part is the line starting <code>IRB.conf[:IRB_RC]</code>, which tells <code>irb</code> to run the given when the session starts. Luckily, this happens after rails has finished initializing. I've set it to require <code>config/console.rb</code>, to which I can add all sorts of configuration and helpers, knowing it will only get loaded in <code>script/console</code> sessions where I want these shortcuts, not in my general code. Here it is:</p>
+<p>The key part is the line starting <code>IRB.conf[:IRB_RC]</code>, which tells <code>irb</code> to run the given when the session starts. Luckily, this happens after rails has finished initializing. I&rsquo;ve set it to require <code>config/console.rb</code>, to which I can add all sorts of configuration and helpers, knowing it will only get loaded in <code>script/console</code> sessions where I want these shortcuts, not in my general code. Here it is:</p>
<div class="highlight"><pre><span class="nb">require</span> <span class="no">File</span><span class="o">.</span><span class="n">expand_path</span><span class="p">(</span><span class="no">File</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="bp">__FILE__</span><span class="p">)</span> <span class="o">+</span> <span class="s2">&quot;/../spec/blueprints.rb&quot;</span><span class="p">)</span>
Oops, something went wrong.

1 comment on commit 27bc141

YESSS

Please sign in to comment.