<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mission Data Blog &#187; rails</title>
	<atom:link href="http://www.missiondata.com/blog/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.missiondata.com/blog</link>
	<description>Louisville-based Web Development &#38; Software Engineering</description>
	<lastBuildDate>Tue, 24 Jan 2012 14:58:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>RailsConf Reflections</title>
		<link>http://www.missiondata.com/blog/software-development/590/railsconf-reflections/</link>
		<comments>http://www.missiondata.com/blog/software-development/590/railsconf-reflections/#comments</comments>
		<pubDate>Tue, 24 May 2011 13:59:10 +0000</pubDate>
		<dc:creator>Ernie</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[railsconf]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/?p=590</guid>
		<description><![CDATA[Today, I&#8217;m feeling mostly recovered from my first ever RailsConf, so I thought I would take some time to reflect on what I learned there, and share it with you, my dear reader. So, here we go, in no particular order&#8230; CoffeeScript is happening&#8230; &#8230;whether you like it or not. Personally, I&#8217;m psyched &#8212; it [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I&#8217;m feeling mostly recovered from my first ever RailsConf, so I thought I would take some time to reflect on what I learned there, and share it with you, my dear reader. So, here we go, in no particular order&#8230;</p>
<h3>CoffeeScript is happening&#8230;</h3>
<p>&#8230;whether you like it or not. Personally, I&#8217;m psyched &#8212; it looks like it solves a lot of the annoyances I&#8217;ve had with Javascript syntax, and I got a sweet deal on <a href="http://www.amazon.com/gp/product/1934356786/ref=as_li_ss_tl?ie=UTF8&amp;tag=metautonomous-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399349&amp;creativeASIN=1934356786">CoffeeScript: Accelerated JavaScript Development</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=&amp;l=as2&amp;o=1&amp;a=1934356786&amp;camp=217145&amp;creative=399349" border="0" alt="" width="1" height="1" /> during the conference, which I hope to put to good use starting this week.</p>
<h3>The Rails Community is Awesome</h3>
<p>My wife&#8217;s response after she read my <a href="http://twitter.com/erniemiller">tweets</a> upon my return:</p>
<blockquote><p>&#8220;Just wondered, who is this guy? Dinner anyone? Share a cab? You became an extrovert on your mothership.&#8221;</p></blockquote>
<p>It&#8217;s true, I did. It&#8217;s weird. I&#8217;ve never been to Baltimore before (save time spent between flights at BWI), but among my fellow Rails coders, I&#8217;ve never felt more &#8220;at home.&#8221;</p>
<p>As I thought about all of the people I finally got to thank in person for all they&#8217;ve done to make my time in the Rails community more enjoyable, it really drove home what an awesome community we have. It&#8217;s easy to lose sight of this while working away in Louisville, my little corner of Kentucky.</p>
<p>Aside from this, getting a chance to put a real face to a name, make and receive thank-yous for all the hard work we put in on Rails patches, plugins, and the like, has the effect of re-energizing a developer. I&#8217;d go on and list all of the awesome people I got to meet in person here, but I think it&#8217;d just make <a href="http://twitter.com/casron">@casron</a> more jealous.</p>
<p>I would like to say, however, that Emilio Tagua (<a href="http://twitter.com/miloops">@miloops</a>) has got to be one of the friendliest guys I&#8217;ve ever met. I&#8217;d hoped to catch up with him to thank him for helping me get commits added to ARel back in the 1.x days that were needed for MetaSearch and MetaWhere. Instead, he ended up two seats over from me at Ignite, noticed I was hacking on a Squeel bug, and introduced himself first. Every time I saw him during the remainder of the conference, he had a smile and a kind word. Just an all-around great guy to have met.</p>
<h3>PostgreSQL is awesome, too!</h3>
<p>Now, I should have known this. I had started out using MySQL many years ago, when it had solid speed advantages over PostgreSQL, but far fewer features. Somewhere along the line, that balance shifted, but I stuck with MySQL due to familiarity. Nick Gauthier&#8217;s <a href="http://knowsql.heroku.com/">KnowSQL</a> presentation has made a believer out of me. I&#8217;ll be using PostgreSQL as my RDBMS of choice from here on, and making sure that Squeel works as well as possible with it, too.</p>
<h3>The Fundamentals are ALWAYS Relevant</h3>
<p>There were tons of talks on design patterns, best practices, and so on, and even as long as I&#8217;ve been doing this whole coding thing, there are plenty of areas in which I can improve. In particular, Avdi Grimm&#8217;s talk, <a href="http://avdi.org/talks/confident-code-railsconf-2011/">Confident Code</a>, José Valim&#8217;s talk about the design principles behind the Rails 3 refactoring, and the talk on <a href="http://assets.en.oreilly.com/1/event/59/Building%20Bulletproof%20Views%20Presentation.pdf">Building Bulletproof Views</a> by John Athayde and Bruce Williams all challenged me to elevate my game in these areas.</p>
<h3>HTML5 is sooooo much more than semantic tags</h3>
<p>LocalStorage, audio, video, canvas drawing, web sockets, web workers &#8212; this stuff is all crazy cool and I can&#8217;t wait until more browsers support it. Mike Subelsky&#8217;s <a href="https://github.com/subelsky/html5tutorial/raw/master/tutorial.html">HTML5 tutorial</a> was a real eye-opener.</p>
<p>That&#8217;s about it, for now. What were some of your takeaways from RailsConf this year?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/software-development/590/railsconf-reflections/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rails fixtures with models using set_table_name</title>
		<link>http://www.missiondata.com/blog/systems-integration/80/rails-fixtures-with-models-using-set_table_name/</link>
		<comments>http://www.missiondata.com/blog/systems-integration/80/rails-fixtures-with-models-using-set_table_name/#comments</comments>
		<pubDate>Mon, 23 Apr 2007 03:13:47 +0000</pubDate>
		<dc:creator>darrend</dc:creator>
				<category><![CDATA[Systems Integration]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/uncategorized/80/rails-fixtures-with-models-using-set_table_name/</guid>
		<description><![CDATA[If you have a model that uses set_table_name you may hit a snag when trying to use fixtures and unit tests. The solution is twofold: name the fixture file using the legacy table name, and use the set_fixture_class method in your unit test. I coudn&#8217;t find this method mentioned in Agile Web Development with Rails, [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a model that uses <tt>set_table_name</tt> you may hit a snag when trying to use fixtures and unit tests. The solution is twofold: name the fixture file using the legacy table name, and use the <tt>set_fixture_class</tt> method in your unit test. I coudn&#8217;t find this method mentioned in <em>Agile Web Development with Rails</em>, and there&#8217;s only a brief mention on the <a href="http://wiki.rubyonrails.com/rails/pages/HowToUseLegacySchemas">rubyonrails.com site</a>. Still, some web searches turned up the answers.</p>
<p>Here is a simple example:</p>
<p><span id="more-80"></span></p>
<p>We&#8217;ll start with a table named <code>libris_book</code> that contains book entries. The name <em>libris_book</em> won&#8217;t really fly with the Rails pluralized table name approach. It&#8217;s easy, however, to fix that disconnect in the model:</p>
<pre><code>class Book &amp;lt; ActiveRecord::Base
  set_table_name 'libris_book'
end</code></pre>
<p>Let&#8217;s take a look at our data:</p>
<pre><code class="console">~/src/libris$ script/console
Loading development environment.
&amp;gt;&amp;gt; Book.count
=&amp;gt; 1230</code></pre>
<p>Good enough. Now, we&#8217;ll be good little coders and write some unit tests using fixtures. We&#8217;ll create a fixture file and our test class:</p>
<p><tt>books.yml</tt></p>
<pre><code>test_book:
  title: Life in Lawrenceburg
  author: Darren Day</code></pre>
<p><tt>book_test.rb</tt></p>
<pre><code>require File.dirname(__FILE__) + '/../test_helper'

class BookTest &amp;lt; Test::Unit::TestCase
  fixtures :books

  def test_fixtures
    assert_equal(2,Book.count)
    test_book = books(:test_book)
  end
end</code></pre>
<p>Looks good, but it won&#8217;t work!</p>
<pre><code class="console">~/src/libris$ rake test
(in /home/darrend/src/libris)
/usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake/rake_test_loader.rb" "test/unit/book_test.rb"
Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake/rake_test_loader
Started
E
Finished in 0.01133 seconds.

  1) Error:
test_fixtures(BookTest):
ActiveRecord::StatementInvalid: Mysql::Error: Table 'libris_test.books' doesn't exist: DELETE FROM books
...</code></pre>
<p>Ugh. That doesn&#8217;t look pretty. After some <a href="http://www.google.com/search?q=set_table_name+fixtures">googling around</a> the following comes together</p>
<ul>
<li>Rename <tt>books.yml</tt> to <tt>libris_book.yml</tt>. The fixture yaml file has to share the same name as the database table name.</li>
<li>Change the <tt>fixtures</tt> declaration to <code>fixtures :libris_book</code>.</li>
<li> Use <tt>set_fixture_class</tt> to connect the fixture to the model class.</li>
</ul>
<p>Here is our new and improved <tt>book_test.rb</tt> file:</p>
<pre><code>require File.dirname(__FILE__) + '/../test_helper'

class BookTest &amp;lt; Test::Unit::TestCase
  set_fixture_class :libris_book =&amp;gt; Book
  fixtures :libris_book

  def test_fixtures
    assert_equal(2,Book.count)
    test_book = libris_book(:test_book)
  end
end</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/systems-integration/80/rails-fixtures-with-models-using-set_table_name/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Latest on Rails Performance</title>
		<link>http://www.missiondata.com/blog/web-development/70/latest-on-rails-performance/</link>
		<comments>http://www.missiondata.com/blog/web-development/70/latest-on-rails-performance/#comments</comments>
		<pubDate>Mon, 02 Apr 2007 01:02:53 +0000</pubDate>
		<dc:creator>carsonm</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails performance test]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/uncategorized/70/latest-on-rails-performance/</guid>
		<description><![CDATA[Updated Rails 1.2 performance numbers have been released. While these number look pretty good it is hard to get a good idea of exactly what the performance of Rails is. A couple of other benchmarks that include Rails such as performance tests for 6 frameworks and Grails vs Rails benchmarks show a different picture. Both [...]]]></description>
			<content:encoded><![CDATA[<p>Updated <a href="http://railsexpress.de/blog/articles/2007/04/01/rails-1-2-performance">Rails 1.2 performance</a> numbers have been released. While these number look pretty good it is hard to get a good idea of exactly what the performance of Rails is. A couple of other benchmarks that include Rails such as <a href="http://www.alrond.com/en/2007/jan/25/performance-test-of-6-leading-frameworks/">performance tests for 6 frameworks</a> and <a href="http://grails.org/Grails+vs+Rails+Benchmark">Grails vs Rails benchmarks</a> show a different picture. Both of these come up with much worse performance than the first. Maybe the issue is that the second two benchmarks are using <a href="http://httpd.apache.org/docs/2.0/programs/ab.html">Apache ab</a> but the first uses a <a href="http://railsexpress.de/blog/articles/2007/04/01/new-railsbench-release-0-9-2">new version</a> of <a href="http://railsbench.rubyforge.org/">rails bench</a>. Of course most people probably aren&#8217;t that worried about the benchmarks that much because you can find ways to make anything fast as shown with <a href="http://joyeur.com/2007/02/04/a-brief-update-with-some-numbers-for-hardware-load-balanced-mongrels">Rails doing 4000 requests a second</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/web-development/70/latest-on-rails-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cleaning Up Rails Sessions, Revisited</title>
		<link>http://www.missiondata.com/blog/web-development/63/cleaning-up-rails-sessions-revisited/</link>
		<comments>http://www.missiondata.com/blog/web-development/63/cleaning-up-rails-sessions-revisited/#comments</comments>
		<pubDate>Sat, 16 Sep 2006 16:15:30 +0000</pubDate>
		<dc:creator>Rich Rodriguez</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=63</guid>
		<description><![CDATA[In an earlier post, we detailed a method for removing stale Rails session files. In more recent version of Rails, there is a Rake task built in for this administration task. rake tmp:sessions:clear # Clears all files in tmp/sessions]]></description>
			<content:encoded><![CDATA[<p>In an earlier <a href="http://blogs.missiondata.com/?p=58">post</a>, we detailed a method for removing stale Rails session files. In more recent version of Rails, there is a Rake task built in for this administration task.</p>
<p><code class="console">rake tmp:sessions:clear # Clears all files in tmp/sessions</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/web-development/63/cleaning-up-rails-sessions-revisited/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cleaning up stale rails sessions (removing ruby_sess files)</title>
		<link>http://www.missiondata.com/blog/web-development/58/cleaning-up-stale-rails-sessions-removing-ruby_sess-files/</link>
		<comments>http://www.missiondata.com/blog/web-development/58/cleaning-up-stale-rails-sessions-removing-ruby_sess-files/#comments</comments>
		<pubDate>Thu, 08 Jun 2006 11:59:02 +0000</pubDate>
		<dc:creator>carsonm</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=58</guid>
		<description><![CDATA[I&#8217;m not sure if something isn&#8217;t set up correctly of if this is just a fact of life with rails but the sessions it creates never seem to go away. I think before rails 1.1 the sessions where stored in /tmp and now they are stored in the apps directory along with everything else so [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure if something isn&#8217;t set up correctly of if this is just a fact of life with rails but the sessions it creates never seem to go away. I think before rails 1.1 the sessions where stored in /tmp and now they are stored in the apps directory along with everything else so they is probably no internal mechanism to delete them. I only noticed because after about a month of an certain app running the disk on the machine started to fill up. After digging a little I found 50K ruby_sess.* files hanging out in the rails session directory.</p>
<p>Anyway it was easy enough to clean up the stale ruby_sess files by going into the rails webapp/session directory and then running the following command:</p>
<pre>
<code>find -type f -name "ruby_sess*" -exec rm -f {} \;</code>
</pre>
<p>I&#8217;m not sure why the app is creating sessions but it isn&#8217;t something that stores state so I didn&#8217;t have to worry about killing active sessions here. If you do need to worry about that you will probably want to toss a time on the find command.</p>
<p>After looking a little more I found a <a href="http://www.realityforge.org/articles/2006/03/01/removing-stale-rails-sessions">post about this</a> that has a ruby way of cleaning up the sessions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/web-development/58/cleaning-up-stale-rails-sessions-removing-ruby_sess-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

