<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Chris Oliver / @excid3</title>
	
	<link>http://excid3.com/blog</link>
	<description>A few fries short of a happy meal</description>
	<lastBuildDate>Tue, 24 Jan 2012 16:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/excid3" /><feedburner:info uri="excid3" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>excid3</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Devise Username Authentication With Multiple Models And Subdomains</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/4XYV9L7q-Jc/</link>
		<comments>http://excid3.com/blog/devise-username-authentication-with-multiple-models-and-subdomains/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 16:00:00 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/?p=1429</guid>
		<description><![CDATA[Devise is an awesome library for authentication with Rails. Things are extremely simple to setup for most cases but when you begin implementing slightly trickier business logic, it can become a pain. And the real reason is mainly just because the wiki needs a little love. They iterate quickly, and documenting everything in a newbie [...]]]></description>
			<content:encoded><![CDATA[<p>Devise is an awesome library for authentication with Rails. Things are extremely simple to setup for most cases but when you begin implementing slightly trickier business logic, it can become a pain. And the real reason is mainly just because the wiki needs a little love. They iterate quickly, and documenting everything in a newbie friendly wiki page is often hard to do. So I&#8217;m going to take a quick stab at documenting my implementation:</p>
<h2>The Problem</h2>
<p>I&#8217;m working on an application that runs on multiple domains and subdomains. Each domain has it&#8217;s own set of admins and users. The admins are tied to a domain, and users are tied to a subdomain of that domain. Both of these need to allow authentication via a username field as opposed to the standard email field.</p>
<p>Starting out, we implemented the models just like normal with Devise. Generate custom views for each, and follow <a href="https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign_in-using-their-username-or-email-address">this tutorial for adding username authentication</a>.</p>
<p>After I got everything setup, admin users could login just fine, but users could not. What was worse, was the Devise Sessions controller was executing but never calling <code> find_for_database_authentication</code> on the model. I had no idea what was going on, and all I could get Devise to do was return a <strong><code>Completed 401 Unauthorized</code></strong> error and immediately re-render the login form.</p>
<p>This is where we differentiate a bit. In that tutorial, they suggest that you set the <code>authentication_keys</code> in <code>devise.rb</code> like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  config.<span style="color:#9900CC;">authentication_keys</span> = <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#ff3333; font-weight:bold;">:login</span> <span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>Well this is actually going to be the source of our problems. In order to authenticate admins based upon a specific domain, we&#8217;re going to include the <code>domain_id</code> inside of the login form as a hidden field. In order to use the <code>domain_id</code> inside the model for authentication, we added it to the authentication_keys array:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  config.<span style="color:#9900CC;">authentication_keys</span> = <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#ff3333; font-weight:bold;">:login</span>, <span style="color:#ff3333; font-weight:bold;">:domain_id</span> <span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>But wait! That works for admins because they are based upon the domain. Users authenticate against a subdomain, not a <code>domain_id</code>. The users need authentication_keys like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  config.<span style="color:#9900CC;">authentication_keys</span> = <span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#ff3333; font-weight:bold;">:login</span>, <span style="color:#ff3333; font-weight:bold;">:subdomain_id</span> <span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>And we put the <code>subdomain_id</code> as a hidden field in their new session form. This is a problem, because the initializer only runs once. We need some way to change this at runtime based upon which type of user is authenticating.</p>
<h2>The solution</h2>
<p>After a long time searching for a solution to the 401 Unauthorized, I found out that the authentication_keys was the cause of the problem (after having a hunch). The bad part was that I wasn&#8217;t able to find a method for debugging the issue.</p>
<p>I found the solution on <a href="http://stackoverflow.com/questions/3298506/about-user-authentication-with-username-and-subdomain">Stack Overflow</a> that pointed out that you&#8217;re actually able to set authentication_keys on the model itself in the devise call like so:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  devise <span style="color:#ff3333; font-weight:bold;">:database_authenticatable</span>, <span style="color:#ff3333; font-weight:bold;">:registerable</span>, ..., <span style="color:#ff3333; font-weight:bold;">:authentication_keys</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:login</span>, <span style="color:#ff3333; font-weight:bold;">:domain_id</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>Nifty! We can set these dynamically without touching the initializer. This lets us cleanly customize the authentication without much work. I&#8217;ll be updating the wiki to add this functionality because I certainly can&#8217;t be the only one who searched long and hard for a solution!</p>
<img src="http://feeds.feedburner.com/~r/excid3/~4/4XYV9L7q-Jc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/devise-username-authentication-with-multiple-models-and-subdomains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/devise-username-authentication-with-multiple-models-and-subdomains/</feedburner:origLink></item>
		<item>
		<title>Happiness Leads To Success, Not The Other Way Around</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/dOCs2el2bQQ/</link>
		<comments>http://excid3.com/blog/happiness-leads-to-success-not-the-other-way-around/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 15:00:00 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/happiness-leads-to-success-not-the-other-way-around/</guid>
		<description />
			<content:encoded><![CDATA[<p><iframe width="560" height="315" src="http://www.youtube.com/embed/GXy__kBVq1M" frameborder="0" allowfullscreen></iframe></p>
<img src="http://feeds.feedburner.com/~r/excid3/~4/dOCs2el2bQQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/happiness-leads-to-success-not-the-other-way-around/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/happiness-leads-to-success-not-the-other-way-around/</feedburner:origLink></item>
		<item>
		<title>Gary Vaynerchuck Keynote at Inc 500</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/EcQdHpfIHVE/</link>
		<comments>http://excid3.com/blog/gary-vaynerchuck-keynote-at-inc-500/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 15:00:00 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/?p=1425</guid>
		<description><![CDATA[I love it. Gary V has so much enthusiasm and drive. What a great talk as always!]]></description>
			<content:encoded><![CDATA[<p>I love it. Gary V has so much enthusiasm and drive. What a great talk as always!</p>
<p><iframe width="560" height="315" src="http://www.youtube.com/embed/lcqCAqZtedI" frameborder="0" allowfullscreen></iframe></p>
<img src="http://feeds.feedburner.com/~r/excid3/~4/EcQdHpfIHVE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/gary-vaynerchuck-keynote-at-inc-500/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/gary-vaynerchuck-keynote-at-inc-500/</feedburner:origLink></item>
		<item>
		<title>Remove Autocomplete URLs From Chrome</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/vAyExlj6XVA/</link>
		<comments>http://excid3.com/blog/remove-autocomplete-urls-from-chrome/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 15:00:00 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/?p=1421</guid>
		<description><![CDATA[At some point yesterday I was doing my usual email checking. It&#8217;s a habit I have when I&#8217;m not sure what to do: I hit the keyboard shortcut for opening a new tab and type &#8220;g&#8221; and hit enter. I&#8217;ve opened up GMail enough times with this shortcut that it always autocompletes first. However, something [...]]]></description>
			<content:encoded><![CDATA[<p>At some point yesterday I was doing my usual email checking. It&#8217;s a habit I have when I&#8217;m not sure what to do: I hit the keyboard shortcut for opening a new tab and type &#8220;<code>g</code>&#8221; and hit enter. I&#8217;ve opened up GMail enough times with this shortcut that it always autocompletes first.</p>
<p>However, something I ended up doing yesterday submitted just the letter &#8220;g&#8221; instead. Now every time it autocompletes that to my Charter search. Horrible.</p>
<p><a href="http://f.cl.ly/items/3b202O2m1R0r3m0J1g3V/Screen%20Shot%202012-01-07%20at%2011.35.03%20AM.png"><img alt="" src="http://f.cl.ly/items/3b202O2m1R0r3m0J1g3V/Screen%20Shot%202012-01-07%20at%2011.35.03%20AM.png" title="g" class="alignnone" width="378" height="111" /></a></p>
<p>If you need to remove a website from Chrome&#8217;s autocomplete suggestions, it&#8217;s really simple:</p>
<pre>Fn + Shift + Delete while highlighting the website you want to remove</pre>
<p>Simple as that. I&#8217;ve also read just <code>Shift + Delete</code> works if you&#8217;re not on a Mac. Do you have any other protips?</p>
<img src="http://feeds.feedburner.com/~r/excid3/~4/vAyExlj6XVA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/remove-autocomplete-urls-from-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/remove-autocomplete-urls-from-chrome/</feedburner:origLink></item>
		<item>
		<title>Year in Review: 2011</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/fA2H16FrE5g/</link>
		<comments>http://excid3.com/blog/year-in-review-2011/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 15:00:00 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/?p=1412</guid>
		<description><![CDATA[As usual, it&#8217;s hard to believe another year has come and gone. Unlike past years, I feel more accomplished. I took some leaps of faith this year and have to admit, those were the best moments of my life. Here are a few lessons I learned throughout the year. I Graduated College As a student [...]]]></description>
			<content:encoded><![CDATA[<p>As usual, it&#8217;s hard to believe another year has come and gone. Unlike past years, I feel more accomplished. I took some leaps of faith this year and have to admit, those were the best moments of my life. Here are a few lessons I learned throughout the year.</p>
<h2>I Graduated College</h2>
<p>As a student I was too protected. If I messed up I could retake the class. If I didn&#8217;t have much money, I could get student loans. If I didn&#8217;t want to work on a team project, I could have someone on my team who was more driven do my part for me if I procrastinated enough. I had parents who were always willing to buy me food and clothes when I came home to visit. Worst case scenario? I could fail out and live with my parents. There was nothing to be afraid of, and yet, because there was no challenge, nothing at risk, I was more depressed than I had ever been in my life.</p>
<p>Even now, I&#8217;m too protected. The experience of college wasn&#8217;t what I wanted. I didn&#8217;t fit in. Against better judgement, I stayed. I didn&#8217;t want to feel rejected by parents and family for dropping out. I regret not taking the jump and quitting. Everything is 20/20 in retrospect. Things would have worked out had I quit college, but in the moment there is always so much uncertainty.</p>
<p>I learned that lesson the hard way. Through the worrying and depression, I learned a lot about myself. I learned that I need a constant challenge. I learned that I absolutely love writing (I may not be good at it yet, but at least I enjoy it). Sure, I got a degree and met a handful of great people who I will always consider friends, but I didn&#8217;t have the experience I had expected.</p>
<p>The best part about it? I realized that if I don&#8217;t truly enjoy what I&#8217;m doing, it&#8217;s not worth my time. Life is too short to do things you hate. Instead of telling everyone &#8220;I&#8217;ll be happy in X years when I can get such and such job&#8221; I have it right now.</p>
<p>This is different for everyone, of course. Not everyone enjoys risk the same way. Some people love being comfortable and I respect that. The important part is to learn who you are. Embrace it. Then find ways to improve yourself.</p>
<h2>Got A Job I Love</h2>
<p>People have asked me how I liked my new job. I get to build web apps every day, something I&#8217;ve dreamed of for quite a while. Often I&#8217;ll respond with &#8220;I haven&#8217;t worked a day since I started.&#8221; They are sometimes confused by that response. But why? Aren&#8217;t they doing something they absolutely love? Sadly, most of them are not. They are stuck in the system, and sadly, some of them may never realize they can break out of this rut. </p>
<p>The &#8220;system&#8221; that we have to follow? Turns out it&#8217;s all bullshit. 1) Go to college 2) Get a job 3) Save some money 4) ???? 5) Finally go enjoy life</p>
<p>Steve Jobs put it best:<br />
<iframe width="560" height="315" src="http://www.youtube.com/embed/UvEiSa6_EPA" frameborder="0" allowfullscreen></iframe></p>
<p>So ask yourself, are you doing what you love? If you say &#8220;Well I&#8217;m just doing this until&#8230;&#8221; then YOU are caught in the system. Think about it. Do some soul searching. You only have a few years on this planet. Make the most of it.</p>
<h2>Formed Good Habits</h2>
<p>This year, as I began to better understand myself, I decided it would be good to start picking up some better habits. Every morning I do a set of pushups and sit-ups. Every night I read a couple chapters of a book. Not blogs. A book. Something that went through editing several times. Something more than just a late night rant on a blog somewhere.</p>
<p>And then it all stopped. I went home for the weekend and broke my habit. It&#8217;s a dreadful feeling. I was doing so good, and yet, getting backup on the horse seems so hard again. Guess what? It&#8217;s not. Just like the pomodoro technique, you&#8217;ve just got to try again. It&#8217;s not as hard as you think. Your mind likes to play tricks on you. Things seem worse than they really are. It makes you think that picking up a book every night is hard for some reason.</p>
<p>Start a new habit. You know it&#8217;s good for you, so don&#8217;t break that habit. No. matter. what. Eventually it will become routine and you will feel weird not doing it. The best things in life aren&#8217;t always easy. Sometimes it takes a lot of hard work and determination. Your mind is the problem with these things. Know that you can conquer it.</p>
<p><a href="http://www.amazon.com/The-Flinch-ebook/dp/B0062Q7S3S">The Flinch</a> is a really good book about pushing your boundaries and doing the things you know you should be doing. Read it several times if you have to. There is no reason that you can&#8217;t become the person you want to be. It&#8217;s all in your head.</p>
<h2>Conclusion</h2>
<p>Over the past year, I think the majority of what I learned was who I am as a person. I have plenty of flaws. I&#8217;m not perfect. The best realization I had this year was exactly that. I&#8217;m not perfect, but I can now be conscious of that. I can fix my flaws. I can improve myself. Nothing says I have to continue being &#8220;who I am.&#8221; No. I can challenge myself. I&#8217;ll never stop learning, but what I will stop doing is things I don&#8217;t enjoy. There&#8217;s not enough time for that. I don&#8217;t have to follow the system. It&#8217;s just there as a guideline.</p>
<blockquote><p> “Here&#8217;s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. They&#8217;re not fond of rules. And they have no respect for the status quo. You can quote them, disagree with them, glorify or vilify them. About the only thing you can&#8217;t do is ignore them. Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do.” &#8211; Steve Jobs</p></blockquote>
<img src="http://feeds.feedburner.com/~r/excid3/~4/fA2H16FrE5g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/year-in-review-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/year-in-review-2011/</feedburner:origLink></item>
		<item>
		<title>Rails Tip #4: Rails Time Select Like Google Calendar</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/W-x4hvv-UPU/</link>
		<comments>http://excid3.com/blog/rails-tip-4-rails-time-select-like-google-calendar/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 15:00:00 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/?p=1394</guid>
		<description><![CDATA[Something that has always bothered me is the way we input dates and times on the web. It&#8217;s still not pretty yet. It&#8217;s bad. jQuery plugins and large calendar might be alright for dates, but times? They still suck horribly. Look at what Rails gives us by default for a date and time selector: That [...]]]></description>
			<content:encoded><![CDATA[<p>Something that has always bothered me is the way we input dates and times on the web. It&#8217;s still not pretty yet. It&#8217;s bad. jQuery plugins and large calendar might be alright for dates, but times? They still suck horribly.</p>
<p>Look at what Rails gives us by default for a date and time selector:</p>
<p><a href="http://f.cl.ly/items/3E0g35362y032j1U2b3k/Screen%20Shot%202011-12-23%20at%2012.16.23%20AM.png"><img alt="" src="http://f.cl.ly/items/3E0g35362y032j1U2b3k/Screen%20Shot%202011-12-23%20at%2012.16.23%20AM.png" title="datetime_select" class="alignnone" width="350" height="25" /></a></p>
<p>That is just nasty. It&#8217;s a 24 hour time selector and separated into separate fields. The iPhone/iPad have a nice little spinner, but that&#8217;s only useful if you have a touch screen. Google Calendar&#8217;s time picker so far has been my favorite. I wanted to emulate that and found a nice little <a href="https://github.com/tamoyal/simple_time_select">library</a> that did what I wanted.</p>
<p>It&#8217;s not a magical solution, but it works well enough:</p>
<p><a href="http://f.cl.ly/items/1945331M3W1h0f1K3I2v/Screen%20Shot%202011-12-23%20at%2012.08.37%20AM.png"><img alt="" src="http://f.cl.ly/items/1945331M3W1h0f1K3I2v/Screen%20Shot%202011-12-23%20at%2012.08.37%20AM.png" title="time_select" class="alignnone" width="96" height="30" /></a></p>
<p>Awesome! But then I realized, nobody really maintained this anymore. And on top of that, there was no good solution for using the value returned. It&#8217;s not in the params name that works well the built-in Rails form.</p>
<h3>Announcing combined_time_select</h3>
<p>I spent some time on this because a combined time select field is something I want to use quite often. The following is an example of how you would use the gem in both the view and the controller. It works cleanly with the date_select field on the same attribute.</p>
<p><script src="https://gist.github.com/1513370.js?file=README.md"></script></p>
<p>The parse_time_select converts the params into a Time object so that we can assign it to an attribute easily. It is, of course, not required if you would like to do the time parsing yourself.</p>
<p>Check out <code>combined_time_select</code> on Github: <a href="https://github.com/excid3/combined_time_select">github.com/excid3/combined_time_select</a></p>
<p>Or install it with Bundler:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  gem <span style="color:#996600;">&quot;combined_time_select&quot;</span>, <span style="color:#996600;">&quot;~&gt; 0.0.1&quot;</span></pre></div></div>

<p>If you have any questions, comments, or ideas let me know!</p>
<img src="http://feeds.feedburner.com/~r/excid3/~4/W-x4hvv-UPU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/rails-tip-4-rails-time-select-like-google-calendar/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/rails-tip-4-rails-time-select-like-google-calendar/</feedburner:origLink></item>
		<item>
		<title>Rails Tip #4: Seedbed</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/Z9hv9XrEmDI/</link>
		<comments>http://excid3.com/blog/rails-tip-4-seedbed/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 15:00:00 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/?p=1386</guid>
		<description><![CDATA[Depending on your project, you might need to create a significant amount of seed data. Upon launch, you&#8217;ll probably need your team setup as admin users, get some content up on the site so it doesn&#8217;t look like a barren wasteland. Sure, I know how to do that. I&#8217;ll just slap it all into db/seeds.rb! [...]]]></description>
			<content:encoded><![CDATA[<p>Depending on your project, you might need to create a significant amount of seed data. Upon launch, you&#8217;ll probably need your team setup as admin users, get some content up on the site so it doesn&#8217;t look like a barren wasteland.</p>
<p>Sure, I know how to do that. I&#8217;ll just slap it all into <code>db/seeds.rb</code>!</p>
<p>That&#8217;s fine&#8230;if you&#8217;re only create a handful of things. Say you want to organize things? Say you want folders? Say you want to only run certain seeds?</p>
<h2>In Comes Seedbed</h2>
<p><a href="https://github.com/esmarkowski/seedbed">Seedbed</a> allows you to create files in the <code>db/seeds/</code> directory that you can run either individually or you can &#8220;plant&#8221; them in <code>seeds.rb</code>.</p>
<p>Take this for example:</p>
<p><script src="https://gist.github.com/1474669.js?file=admins.rb"></script></p>
<p>Here we&#8217;ve got a seed that creates only Admin users. With seedbed, we can put this file inside <code>db/seeds/</code> and then execute it like so:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">rake db:seed:admins</pre></div></div>

<p>How cool is that? Say we&#8217;re playing around with features and need to truncate the Admin Users table locally. We can repopulate the admins very simply without recreating the whole set of seeds.</p>
<p>You can even add them to <code>db/seeds.rb</code> to automatically run the nested seeds themselves:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">plant <span style="color:#ff3333; font-weight:bold;">:admins</span></pre></div></div>

<p>And run the <code>rake db:seed</code> command as normal to automatically run all of the custom seed files.</p>
<p><a href="https://github.com/esmarkowski/seedbed">Seedbed on Github</a></p>
<img src="http://feeds.feedburner.com/~r/excid3/~4/Z9hv9XrEmDI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/rails-tip-4-seedbed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/rails-tip-4-seedbed/</feedburner:origLink></item>
		<item>
		<title>Maybe Your Life Is Too Easy</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/H11hWwd8swk/</link>
		<comments>http://excid3.com/blog/maybe-your-life-is-too-easy/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 15:00:33 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/?p=1378</guid>
		<description><![CDATA[Yesterday I was watching this TED talk and I was truly impressed by her story. What I realized after watching this was that the reason her story is amazing, it is because she had faced incredible challenges. It&#8217;s rare for anyone to tell a story like this who has been given everything. In fact, I [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was watching this TED talk and I was truly impressed by her story.</p>
<p><iframe width="560" height="315" src="http://www.youtube.com/embed/N2QZM7azGoA" frameborder="0" allowfullscreen></iframe></p>
<p>What I realized after watching this was that the reason her story is amazing, it is because she had faced incredible challenges. It&#8217;s rare for anyone to tell a story like this who has been given everything. In fact, I can&#8217;t think of a single story like that.</p>
<p>Amy was more depressed than I can probably imagine but she turned things around and became a snowboarder. The guys at Airbnb were dead broke and they created <a href="http://www.airbnb.com/obamaos">cereal boxes</a> in order to raise money to survive. Even looking back in my own life, one of my best programming accomplishments was because I was trying to live on dialup.</p>
<p>There are many many stories like this. And here you sit, dreaming about what things you&#8217;d like to accomplish. If only you had lots of money. If only you had this or that. If only.</p>
<p>You&#8217;ve probably always been living an &#8220;easy&#8221; life. Think about it. You&#8217;ve got all your limbs, good family and friends. Your parents bought you a car when you turned sixteen. Your parents paid for college. But yet, you&#8217;ve never been happy with your grades, your relationships, your job, or where you wanted to be at this point in life? Maybe it&#8217;s because things are too easy. </p>
<p>Maybe you need to try something completely different for a while. Risk it all, see what happens. <a href="http://www.amazon.com/The-Flinch-ebook/dp/B0062Q7S3S">The flinch</a> of doing something different might be the reason you are holding back.</p>
<p>It&#8217;s easy to take things for granted. Soon enough you are making a steady paycheck living an easy life and then what? You become boring.</p>
<blockquote><p>&#8220;Hey how have you been?&#8221;<br />
Oh just busy working/studying/whatever.</p>
<p>&#8220;That&#8217;s cool. I just got back from mountain climbing in the alps.&#8221;<br />
Wow! That&#8217;s awesome! I wish I could do things like that.</p></blockquote>
<p>Well why the hell not? I even look at my friend <a href="http://twitter.com/wfjackson3">Willis</a> and am constantly impressed with his entrepreneurship. While he will be the first to tell you that he has no idea what he is doing, I&#8217;m still impressed none the less.</p>
<p>Sometimes you need to take a leap of faith and risk what you&#8217;ve got. After all, you&#8217;ve probably got more than lots of other people on this planet. Can you live without your television, fancy kitchen utensils, and heated blankets? Absolutely. Then make a bet on yourself. If you don&#8217;t do something you have always wanted to do in the next month, you&#8217;ll sell your TV. Have someone else hold you accountable. Push your boundaries.</p>
<p>I know I have gotten far too comfortable with my life. Sleeping late, off to work in the mornings, have a nice dinner, kick back and watch a movie, go to bed, rinse and repeat. But I feel terrible about it. I&#8217;m not progressing towards much. Things are too comfortable right now. I know that I&#8217;m stalled in my progression, but it&#8217;s time to move on. To get back in that groove. No more being comfortable. Things are too easy.</p>
<p>The last thing I want is to look back on my life and regret how I spent my time. I&#8217;m looking at you Skyrim:<br />
<iframe width="420" height="315" src="http://www.youtube.com/embed/rt5aUdijAN8" frameborder="0" allowfullscreen></iframe></p>
<p>So to start off, I&#8217;m making a list of things I want to accomplish in the next year and having my friend hold me to it. What are some life experiences you&#8217;ve had and wish more people tried?</p>
<img src="http://feeds.feedburner.com/~r/excid3/~4/H11hWwd8swk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/maybe-your-life-is-too-easy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/maybe-your-life-is-too-easy/</feedburner:origLink></item>
		<item>
		<title>Long Walks Are My Evening Long Showers</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/OVwComJdaKg/</link>
		<comments>http://excid3.com/blog/long-walks-are-my-evening-long-showers/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 15:00:00 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/long-walks-are-my-evening-long-showers/</guid>
		<description><![CDATA[This might be a post more for myself than for others, but hey, I started this blog to keep track of my own thoughts. I&#8217;m just happy if anyone gets a nugget of help or inspiration. Lately I haven&#8217;t been feeling as good as usual. The time change makes the sun set incredibly early now. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://excid3.com/blog/wp-content/uploads/2011/12/mzSec.jpg"><img class="alignright size-full wp-image-1372" title="mzSec" src="http://excid3.com/blog/wp-content/uploads/2011/12/mzSec.jpg" alt="" width="390" height="299" /></a><br />
This might be a post more for myself than for others, but hey, I started this blog to keep track of my own thoughts. I&#8217;m just happy if anyone gets a nugget of help or inspiration.</p>
<p>Lately I haven&#8217;t been feeling as good as usual. The time change makes the sun set incredibly early now. I picked up the Elder Scrolls: Skyrim and basically didn&#8217;t go outside for a week and a half. I stopped working out. I stopped my evening reading. It was terrible.</p>
<p>But I think I&#8217;ve beaten it. Everyone knows that some of our best thinking gets done in the mornings in the shower. It&#8217;s awesome. I&#8217;ve talked myself through a lot of complicated things before. After realizing that I was losing track, I wondered how I could fix this downward spiral.</p>
<p>My solution? Talking long walks. I&#8217;ll walk for at least half an hour. Nowhere in particular. The fresh air, the atmosphere of the city, the bustling the strangers walking down the street. All of these things I don&#8217;t get at the office or at home for extended periods of time.</p>
<p>Sure, I&#8217;m probably more prone to depression than some people. My mom is like this, my grandparents, and so on. It&#8217;s beatable, but the wrong thing to do is worry. I can sit there staring my email all night and get nothing done, or I can go relax for a bit and then come back and work hard for an hour productively.</p>
<p>At the end of the day things can feel pretty awful. You had a bad day at work, relationship problems, whatever. My solution is to go take a walk. Think about it. Think if it is really that bad. Chances are it isn&#8217;t. Make sure to take time out of the day for yourself to think and be detached.</p>
<p>Quit worrying about things so much. It will always work out in the end. No happiness ever comes out of worrying.</p>
<img src="http://feeds.feedburner.com/~r/excid3/~4/OVwComJdaKg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/long-walks-are-my-evening-long-showers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/long-walks-are-my-evening-long-showers/</feedburner:origLink></item>
		<item>
		<title>Rails Tip #3: Annotate</title>
		<link>http://feedproxy.google.com/~r/excid3/~3/K5QMBXsBqGw/</link>
		<comments>http://excid3.com/blog/rails-tip-3-annotate/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 15:00:00 +0000</pubDate>
		<dc:creator>excid3</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://excid3.com/blog/?p=1364</guid>
		<description><![CDATA[As you jump between Rails projects, you&#8217;ll quickly realize that you end up checking the database schema to see which attributes your model has. This can get annoying to say the least, and that&#8217;s what the Annotate gem aims to solve. It&#8217;s a quick install in your Gemfile: gem &#34;annotate&#34;, &#34;~&#62; 2.4.0&#34;, :group =&#62; :development [...]]]></description>
			<content:encoded><![CDATA[<p>As you jump between Rails projects, you&#8217;ll quickly realize that you end up checking the database schema to see which attributes your model has. This can get annoying to say the least, and that&#8217;s what the <a href="https://rubygems.org/gems/annotate">Annotate gem</a> aims to solve.</p>
<p>It&#8217;s a quick install in your <code>Gemfile</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">gem <span style="color:#996600;">&quot;annotate&quot;</span>, <span style="color:#996600;">&quot;~&gt; 2.4.0&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:group</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:development</span></pre></div></div>

<p>Afterwards, just run <code>bundle install</code> and you&#8217;re ready to go. Just type <code>annotate</code> in terminal inside your rails application directory and it will generate comments in your models that look similar to this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> LineItem <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  belongs_to <span style="color:#ff3333; font-weight:bold;">:product</span>
<span style="color:#9966CC; font-weight:bold;">end</span> 
&nbsp;
<span style="color:#008000; font-style:italic;"># == Schema Info</span>
<span style="color:#008000; font-style:italic;">#</span>
<span style="color:#008000; font-style:italic;"># Table name: line_items</span>
<span style="color:#008000; font-style:italic;">#</span>
<span style="color:#008000; font-style:italic;">#  id                  :integer(11)    not null, primary key</span>
<span style="color:#008000; font-style:italic;">#  quantity            :integer(11)    not null</span>
<span style="color:#008000; font-style:italic;">#  product_id          :integer(11)    not null</span>
<span style="color:#008000; font-style:italic;">#  unit_price          :float</span>
<span style="color:#008000; font-style:italic;">#  order_id            :integer(11)</span>
<span style="color:#008000; font-style:italic;">#  created_at          :datetime</span>
<span style="color:#008000; font-style:italic;">#  updated_at          :datetime</span>
<span style="color:#008000; font-style:italic;">#</span></pre></div></div>

<p>And there you go! You&#8217;re able to easily reference what columns each model. While it&#8217;s not anything groundbreaking, it saves me a couple minutes every day.</p>
<img src="http://feeds.feedburner.com/~r/excid3/~4/K5QMBXsBqGw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://excid3.com/blog/rails-tip-3-annotate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://excid3.com/blog/rails-tip-3-annotate/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.481 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-01-24 11:08:35 -->

