<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>A Ruby on Rails Journey</title>
	<atom:link href="http://dkrails.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dkrails.wordpress.com</link>
	<description>A Windows and VBA Guy Tries to Learn Ruby on Rails</description>
	<lastBuildDate>Thu, 06 Oct 2011 21:14:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dkrails.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>A Ruby on Rails Journey</title>
		<link>http://dkrails.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dkrails.wordpress.com/osd.xml" title="A Ruby on Rails Journey" />
	<atom:link rel='hub' href='http://dkrails.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Nifty Authentication</title>
		<link>http://dkrails.wordpress.com/2011/10/06/nifty-authentication/</link>
		<comments>http://dkrails.wordpress.com/2011/10/06/nifty-authentication/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 21:14:07 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[survivor]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=58</guid>
		<description><![CDATA[For my survivor pool app, I need users. I&#8217;ll use nifty-generators nifty:authentication to do it. First I type rails g nifty:authentication --help to figure out what&#8217;s what. It recommends that I install nifty:layout first, so I do. rails g nifty:layout It asked me if I wanted to overwrite application.html.erb and I said &#8220;Y&#8221;. Next I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=58&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For my survivor pool app, I need users.  I&#8217;ll use nifty-generators nifty:authentication to do it.  First I type</p>
<p><code>rails g nifty:authentication --help</code></p>
<p>to figure out what&#8217;s what.  It recommends that I install nifty:layout first, so I do.</p>
<p><code>rails g nifty:layout</code></p>
<p>It asked me if I wanted to overwrite application.html.erb and I said &#8220;Y&#8221;.  Next I install authentication</p>
<p><code>rails g nifty:authentication</code></p>
<p>When I try to start the server, it complains that I don&#8217;t have the mocha gem.  Oh yeah, I probably need to do some stuff first.</p>
<p><code>bundle install<br />
rake db:migrate</code></p>
<p>Now I can start the server and navigate to http://localhost:3000/signup and it works a treat.  Before I push these changes up to heroku, I want to make a landing page so it&#8217;s not the rails default one.  For now, I delete public/index.html and put</p>
<p><code>root :to =&gt; "users#new"</code></p>
<p>in config/routes.rb.  The landing page will be the signup page for now.  Next, push it up to heroku</p>
<p><code>git push heroku master<br />
heroku rake db:migrate</code></p>
<p>Ugh.  Heroku uses postgres and my Rails app is in sqlite3.  I&#8217;ll post how I fix it, but I&#8217;ll bet it won&#8217;t be pretty</p>
<br />Filed under: <a href='http://dkrails.wordpress.com/category/survivor/'>survivor</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=58&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2011/10/06/nifty-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>
	</item>
		<item>
		<title>Survivor Pool Setup</title>
		<link>http://dkrails.wordpress.com/2011/10/04/survivor-pool-setup/</link>
		<comments>http://dkrails.wordpress.com/2011/10/04/survivor-pool-setup/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 02:29:36 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[survivor]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=54</guid>
		<description><![CDATA[Maybe one of these days I&#8217;ll actually complete a rails app. Maybe it will be this one. Maybe not. But I hate doing anything of substance and not blogging about it. I like to go back and read what I did because I don&#8217;t do rails stuff enough to be efficient yet. In any case, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=54&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Maybe one of these days I&#8217;ll actually complete a rails app.  Maybe it will be this one.  Maybe not.  But I hate doing anything of substance and not blogging about it.  I like to go back and read what I did because I don&#8217;t do rails stuff enough to be efficient yet.</p>
<p>In any case, my current project is an NFL survivor pool.  Pick one team each week.  If they win, you survive.  If they lose, you&#8217;re out.  Pretty simple.</p>
<p>I had Ruby 1.8.6 on my Windows 7 machine and Rails 2.3.8.  I wrote a good deal of the app, but for some reason I couldn&#8217;t push it up to heroku.  I decided to upgrade to Ruby 1.9.2 and Rails 3.1.  I installed <a href="http://railsinstaller.org/">RailsInstaller 2.0</a> and it was a disaster.  I would try to execute commands from the command line and it was clearly looking in the old 1.8.6 directory and couldn&#8217;t find them.  I&#8217;ll bet it&#8217;s not really that hard to have multiple ruby versions, but honestly I don&#8217;t care to learn.  I wiped out everything; uninstall RailsInstaller, delete Ruby directories, delete Git directories.  Then I reinstalled RailsInstaller and things seemed to be working better.</p>
<p>I executed ruby -v and got 1.9.2.  Good.  I executed rails -v and got &#8220;file not found&#8221;.  Then I did</p>
<p><code>gem install rails</code></p>
<p>and</p>
<p><code>gem install heroku</code></p>
<p>and they installed without incident.  Now rails -v returned 3.1.  Good.  Next, I attempted to run my app locally.  It told me I needed to install Rails 2.3.8 when I executed script/server.  I didn&#8217;t want to use 2.3.8, so I commented out the RAILS_GEM_VERSION line in config/environment.rb.  It was set to 2.3.8 and commenting it out should force it use the latest version of Rails.  There&#8217;s probably a crapload of code in the app that won&#8217;t execute using Rails 3.  I don&#8217;t know and I&#8217;m not that interested to find out.  So I opted to start from scratch in Rails 3.  That sounds like a big cop-out and it is. But the code will be far less crappy, as code always is when you write it the second time.  So I</p>
<p><code>rails new dkusr2</code></p>
<p>to make a new app called dksur2.  I like to use nifty-generators, so I added</p>
<p><code>gem 'nifty-generators', :group =&gt; :development</code></p>
<p>to my Gemfile and, back at the command line, ran </p>
<p><code>bundle install</code></p>
<p>It gave me a bunch of &#8220;Using&#8221; statements, which I think means it&#8217;s already installed, and one &#8220;Installing nifty-generators (0.4.6)&#8221; statement, which seems to be a good sign.</p>
<p>The next step was to get the empty app on git.</p>
<p><code>dick@DICK-HPELITE /c/sites/dksur2<br />
$ git init<br />
Initialized empty Git repository in c:/sites/dksur2/.git/</code></p>
<p><code>dick@DICK-HPELITE /c/sites/dksur2 (master)<br />
$ git add .</code></p>
<p><code>dick@DICK-HPELITE /c/sites/dksur2 (master)<br />
$ git commit -m "dksurvivor2"<br />
[master (root-commit) 595bbd0] dksurvivor2<br />
 37 files changed, 1160 insertions(+), 0 deletions(-)<br />
 create mode 100644 .gitignore<br />
 create mode 100644 Gemfile<br />
 create mode 100644 Gemfile.lock<br />
 create mode 100644 README<br />
 create mode 100644 Rakefile<br />
 create mode 100644 app/assets/images/rails.png<br />
 create mode 100644 app/assets/javascripts/application.js<br />
 create mode 100644 app/assets/stylesheets/application.css<br />
 create mode 100644 app/controllers/application_controller.rb<br />
 create mode 100644 app/helpers/application_helper.rb<br />
 create mode 100644 app/mailers/.gitkeep<br />
 create mode 100644 app/models/.gitkeep<br />
 create mode 100644 app/views/layouts/application.html.erb<br />
 create mode 100644 config.ru<br />
 create mode 100644 config/application.rb<br />
 create mode 100644 config/boot.rb<br />
 create mode 100644 config/database.yml<br />
 create mode 100644 config/environment.rb<br />
 create mode 100644 config/environments/development.rb<br />
 create mode 100644 config/environments/production.rb<br />
 create mode 100644 config/environments/test.rb<br />
 create mode 100644 config/initializers/backtrace_silencers.rb<br />
 create mode 100644 config/initializers/inflections.rb<br />
 create mode 100644 config/initializers/mime_types.rb<br />
 create mode 100644 config/initializers/secret_token.rb<br />
 create mode 100644 config/initializers/session_store.rb<br />
 create mode 100644 config/initializers/wrap_parameters.rb<br />
 create mode 100644 config/locales/en.yml<br />
 create mode 100644 config/routes.rb<br />
 create mode 100644 db/seeds.rb<br />
 create mode 100644 doc/README_FOR_APP<br />
 create mode 100644 lib/assets/.gitkeep<br />
 create mode 100644 lib/tasks/.gitkeep<br />
 create mode 100644 log/.gitkeep<br />
 create mode 100644 public/404.html<br />
 create mode 100644 public/422.html<br />
 create mode 100644 public/500.html<br />
 create mode 100644 public/favicon.ico<br />
 create mode 100644 public/index.html<br />
 create mode 100644 public/robots.txt<br />
 create mode 100644 script/rails<br />
 create mode 100644 test/fixtures/.gitkeep<br />
 create mode 100644 test/functional/.gitkeep<br />
 create mode 100644 test/integration/.gitkeep<br />
 create mode 100644 test/performance/browsing_test.rb<br />
 create mode 100644 test/test_helper.rb<br />
 create mode 100644 test/unit/.gitkeep<br />
 create mode 100644 vendor/assets/stylesheets/.gitkeep<br />
 create mode 100644 vendor/plugins/.gitkeep</code></p>
<p>Wow, something worked as I expected it.  Next I created a new heroku app.</p>
<p><code>dick@DICK-HPELITE /c/sites/dksur2 (master)<br />
$ heroku create<br />
Creating evening-snow-8011....... done, stack is bamboo-mri-1.9.2<br />
http://evening-snow-8011.heroku.com/ | git@heroku.com:evening-snow-8011.git<br />
Git remote heroku added</code></p>
<p><code>dick@DICK-HPELITE /c/sites/dksur2 (master)<br />
$ git push heroku master<br />
Enter passphrase for key '/c/Users/dick/.ssh/id_rsa':<br />
Counting objects: 63, done.<br />
Delta compression using up to 8 threads.<br />
Compressing objects: 100% (47/47), done.<br />
Writing objects: 100% (63/63), 25.07 KiB, done.<br />
Total 63 (delta 2), reused 0 (delta 0)</code></p>
<p>and a whole bunch of other lines.  I went to http://evening-snow-8011.heroku.com/ and got the always heart-warming Welcome Aboard message that means I didn&#8217;t screw anything up.</p>
<p>My next step will be to watch <a href="http://railscasts.com/episodes/250-authentication-from-scratch">Authentication from Scratch</a> and <a href="http://railscasts.com/episodes/270-authentication-in-rails-3-1">Authentication in Rails 3.1</a> so I can make my User model and controllers and such.  From there, I expect the app will generally look like:</p>
<p><code>Team<br />
  :name, :string</p>
<p>  has_many :picks<br />
  has_many :users, :through =&gt; picks</p>
<p>Game<br />
  :start, :datetime<br />
  :weekno, :integer<br />
  :away_id, :integer<br />
  :home_id, :integer<br />
  :awayscore, :integer<br />
  :homescore, :integer</p>
<p>  has_one :away, from team on away_id = id<br />
  has_one :home, from team on home_id = id<br />
  has_many :picks</p>
<p>Pick<br />
  :user_id, :integer<br />
  :team_id, :integer<br />
  :game_id, :integer</p>
<p>  belongs_to user, team, game</p>
<br />Filed under: <a href='http://dkrails.wordpress.com/category/survivor/'>survivor</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=54&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2011/10/04/survivor-pool-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>
	</item>
		<item>
		<title>Fixing Up Teams</title>
		<link>http://dkrails.wordpress.com/2010/06/14/fixing-up-teams/</link>
		<comments>http://dkrails.wordpress.com/2010/06/14/fixing-up-teams/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 01:30:38 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[TenthHole]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=43</guid>
		<description><![CDATA[After creating the team object, there are a couple of things I want to do. First, I want to make sure a name is entered when a team is created. I fire up Intype (my favorite rails text editor), open the project, and open team.rb under the models folder. I edit it to look like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=43&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After creating the team object, there are a couple of things I want to do.  First, I want to make sure a name is entered when a team is created.  I fire up Intype (my favorite rails text editor), open the project, and open team.rb under the models folder.  I edit it to look like this</p>
<p><code>
<pre>class Team &lt; ActiveRecord::Base
	validates_presence_of :name
end</code></pre>
<p>Now if I try to make a team but don't type in a name, I get this:</p>
<p><a href="http://dkrails.files.wordpress.com/2010/06/teamvalidationerror.gif"><img src="http://dkrails.files.wordpress.com/2010/06/teamvalidationerror.gif" alt="" title="teamvalidationerror" width="453" height="381" class="alignnone size-full wp-image-44" /></a></p>
<p>Next, in Intype, I open teams_controller.rb and note that <code>@team = Team.find(params[:id])</code> appears a number of times, namely in the Show, Edit, Update, and Destroy defs.  To DRY that up (don't repeat yourself), I'll put that in a before filter.  The top of my teams_controller.rb now looks like this:</p>
<p><code>
<pre>class TeamsController  [:show, :edit, :update, :destroy]

  def index
    @teams = Team.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml =&gt; @teams }
    end
  end</pre>
<p></code></p>
<p>That says before Show, Edit, Update, or Destroy are run, run a method called find_team.  That new method goes at the bottom of teams_controller.rb</p>
<p><code>
<pre>  def destroy
    @team = Team.find(params[:id])
    @team.destroy

    respond_to do |format|
      format.html { redirect_to(teams_url) }
      format.xml  { head :ok }
    end
  end

private
  def find_team
    @team = Team.find(params[:id])
  end

end</pre>
<p></code></p>
<p>Now if I ever need to change that code, I can change it in one place rather than four.</p>
<br />Filed under: <a href='http://dkrails.wordpress.com/category/tenthhole/'>TenthHole</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=43&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2010/06/14/fixing-up-teams/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>

		<media:content url="http://dkrails.files.wordpress.com/2010/06/teamvalidationerror.gif" medium="image">
			<media:title type="html">teamvalidationerror</media:title>
		</media:content>
	</item>
		<item>
		<title>Setting Up Teams</title>
		<link>http://dkrails.wordpress.com/2010/06/14/setting-up-teams/</link>
		<comments>http://dkrails.wordpress.com/2010/06/14/setting-up-teams/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 01:11:59 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[TenthHole]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=38</guid>
		<description><![CDATA[The first object I&#8217;m going to create is a Team object. It only has one property: name. I opened a DOS window, navigated to my app&#8217;s directory and typee: C:\Ruby186\tenthhole&#62;ruby script/generate scaffold Team name:string exists app/models/ exists app/controllers/ exists app/helpers/ create app/views/teams exists app/views/layouts/ exists test/functional/ exists test/unit/ create test/unit/helpers/ exists public/stylesheets/ create app/views/teams/index.html.erb create [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=38&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The first object I&#8217;m going to create is a Team object.  It only has one property: name.  I opened a DOS window, navigated to my app&#8217;s directory and typee:</p>
<p><code>
<pre>C:\Ruby186\tenthhole&gt;ruby script/generate scaffold Team name:string
      exists  app/models/
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/teams
      exists  app/views/layouts/
      exists  test/functional/
      exists  test/unit/
      create  test/unit/helpers/
      exists  public/stylesheets/
      create  app/views/teams/index.html.erb
      create  app/views/teams/show.html.erb
      create  app/views/teams/new.html.erb
      create  app/views/teams/edit.html.erb
      create  app/views/layouts/teams.html.erb
      create  public/stylesheets/scaffold.css
      create  app/controllers/teams_controller.rb
      create  test/functional/teams_controller_test.rb
      create  app/helpers/teams_helper.rb
      create  test/unit/helpers/teams_helper_test.rb
       route  map.resources :teams
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/team.rb
      create    test/unit/team_test.rb
      create    test/fixtures/teams.yml
      create    db/migrate
      create    db/migrate/20100614005533_create_teams.rb</pre>
<p></code></p>
<p>Generating a scaffold will create default code that, while not exactly what you want, will give you working code right off the bat.  In addition to the models, views, and controllers it creates, it also creates a database migration file.  To get my database up to date, I have to run the migration.  From the command prompt:</p>
<p><code>
<pre>C:\Ruby186\tenthhole&gt;rake db:migrate
(in C:/Ruby186/tenthhole)
==  CreateTeams: migrating =========
-- create_table(:teams)
   -&gt; 0.0010s
==  CreateTeams: migrated (0.0030s)</pre>
<p></code></p>
<p>Let&#8217;s see where I am now.  From the command prompt, I start the web server (ruby script/server) and point my browser to http://localhost:3000.</p>
<p><a href="http://dkrails.files.wordpress.com/2010/06/teamscaffoldresult.gif"><img src="http://dkrails.files.wordpress.com/2010/06/teamscaffoldresult.gif?w=300&#038;h=158" alt="" title="teamscaffoldresult" width="300" height="158" class="alignnone size-medium wp-image-39" /></a></p>
<p>Not much there, but no errors.  Now I can start adding teams by clicking on the New Team link.</p>
<p><a href="http://dkrails.files.wordpress.com/2010/06/teamsindex.gif"><img src="http://dkrails.files.wordpress.com/2010/06/teamsindex.gif?w=146&#038;h=300" alt="" title="teamsindex" width="146" height="300" class="alignnone size-medium wp-image-40" /></a></p>
<p>No fancy names here, just numbers.  And one &#8216;team&#8217; that all available substitutes will belong to.  That&#8217;s it for teams.  I can add, delete, and edit the teams all with the code the scaffolding generator created.</p>
<br />Filed under: <a href='http://dkrails.wordpress.com/category/tenthhole/'>TenthHole</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=38&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2010/06/14/setting-up-teams/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>

		<media:content url="http://dkrails.files.wordpress.com/2010/06/teamscaffoldresult.gif?w=300" medium="image">
			<media:title type="html">teamscaffoldresult</media:title>
		</media:content>

		<media:content url="http://dkrails.files.wordpress.com/2010/06/teamsindex.gif?w=146" medium="image">
			<media:title type="html">teamsindex</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating the Rails Application</title>
		<link>http://dkrails.wordpress.com/2010/06/13/creating-the-rails-application/</link>
		<comments>http://dkrails.wordpress.com/2010/06/13/creating-the-rails-application/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 23:23:24 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[TenthHole]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=33</guid>
		<description><![CDATA[With everything installed, I created my new rails app. From the command line: C:\Ruby186&#62;rails tenthhole create create app/controllers create app/helpers create app/models create app/views/layouts create config/environments create config/initializers create config/locales create db create doc create lib create lib/tasks create log create public/images create public/javascripts create public/stylesheets create script/performance create test/fixtures create test/functional create test/integration create [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=33&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>With everything installed, I created my new rails app.  From the command line:</p>
<p><code>
<pre>C:\Ruby186&gt;rails tenthhole
      create
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  config/initializers
      create  config/locales
      create  db
      create  doc
      create  lib
      create  lib/tasks
      create  log
      create  public/images
      create  public/javascripts
      create  public/stylesheets
      create  script/performance
      create  test/fixtures
      create  test/functional
      create  test/integration
      create  test/performance
      create  test/unit
      create  vendor
      create  vendor/plugins
      create  tmp/sessions
      create  tmp/sockets
      create  tmp/cache
      create  tmp/pids
      create  Rakefile
      create  README
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  config/database.yml
      create  config/routes.rb
      create  config/locales/en.yml
      create  db/seeds.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_rails_defaults.rb
      create  config/initializers/session_store.rb
      create  config/initializers/cookie_verification_secret.rb
      create  config/environment.rb
      create  config/boot.rb
      create  config/environments/production.rb
      create  config/environments/development.rb
      create  config/environments/test.rb
      create  script/about
      create  script/console
      create  script/dbconsole
      create  script/destroy
      create  script/generate
      create  script/runner
      create  script/server
      create  script/plugin
      create  script/performance/benchmarker
      create  script/performance/profiler
      create  test/test_helper.rb
      create  test/performance/browsing_test.rb
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/index.html
      create  public/favicon.ico
      create  public/robots.txt
      create  public/images/rails.png
      create  public/javascripts/prototype.js
      create  public/javascripts/effects.js
      create  public/javascripts/dragdrop.js
      create  public/javascripts/controls.js
      create  public/javascripts/application.js
      create  doc/README_FOR_APP
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log</pre>
<p></code></p>
<p>The syntax <code>rails app_name</code> tells rails to create the application with that name and set up all the directories and many of the files I will need.  It puts them all in a directory with the apps name.  With the basics of an app created, I&#8217;ll test it to make sure rails is working.  I navigate to C:\Ruby186\tenthhole\ and type</p>
<p><code>
<pre>C:\Ruby186\tenthhole&gt;ruby script/server
=&gt; Booting WEBrick
=&gt; Rails 2.3.8 application starting on http://0.0.0.0:3000
=&gt; Call with -d to detach
=&gt; Ctrl-C to shutdown server
[2010-06-13 14:30:48] INFO  WEBrick 1.3.1
[2010-06-13 14:30:48] INFO  ruby 1.8.6 (2010-02-04) [i386-mingw32]
[2010-06-13 14:30:48] INFO  WEBrick::HTTPServer#start: pid=4984 port=3000
[2010-06-13 14:34:03] INFO  going to shutdown ...
[2010-06-13 14:34:03] INFO  WEBrick::HTTPServer#start done.</pre>
<p></code></p>
<p>That starts the built-in web server that runs locally.  In the third line from the bottom, I see that it&#8217;s using port 3000, so I open Firefox and navigate to http://localhost:3000 and see this:</p>
<p><a href="http://dkrails.files.wordpress.com/2010/06/railswelcomescreen.gif"><img src="http://dkrails.files.wordpress.com/2010/06/railswelcomescreen.gif?w=300&#038;h=262" alt="" title="railswelcomescreen" width="300" height="262" class="alignnone size-medium wp-image-34" /></a></p>
<p>That screen means rails installed correctly.  Now I can start building my app.  Back at the command line, I hit Control+C to exit the web server.</p>
<br />Filed under: <a href='http://dkrails.wordpress.com/category/tenthhole/'>TenthHole</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=33&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2010/06/13/creating-the-rails-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>

		<media:content url="http://dkrails.files.wordpress.com/2010/06/railswelcomescreen.gif?w=300" medium="image">
			<media:title type="html">railswelcomescreen</media:title>
		</media:content>
	</item>
		<item>
		<title>Installation</title>
		<link>http://dkrails.wordpress.com/2010/06/13/installation/</link>
		<comments>http://dkrails.wordpress.com/2010/06/13/installation/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 23:13:54 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[TenthHole]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=30</guid>
		<description><![CDATA[New computer and new attempt to make a golf league website.  I used Installing Ruby on Rails on Windows as a guide. First, I went to RubyForge and downloaded and installed rubyinstaller-1.8.6-p398.exe. It created a directory at C:\Ruby186\. I opened a DOS command window and navigated to that directory. Then I installed rails: C:\Ruby186&#62;gem install [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=30&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>New computer and new attempt to make a golf league website.  I used <a href="http://wiki.rubyonrails.org/getting-started/installation/windows">Installing Ruby on Rails  on Windows</a> as a guide.</p>
<p>First, I went to <a href="http://rubyforge.org/frs/?group_id=167&amp;release_id=43805">RubyForge</a> and downloaded and installed rubyinstaller-1.8.6-p398.exe.  It created a directory at C:\Ruby186\.</p>
<p>I opened a DOS command window and navigated to that directory.  Then I installed rails:</p>
<p><code>C:\Ruby186&gt;gem install rails<br />
Successfully installed rake-0.8.7<br />
Successfully installed activesupport-2.3.8<br />
Successfully installed activerecord-2.3.8<br />
Successfully installed rack-1.1.0<br />
Successfully installed actionpack-2.3.8<br />
Successfully installed actionmailer-2.3.8<br />
Successfully installed activeresource-2.3.8<br />
Successfully installed rails-2.3.8<br />
8 gems installed<br />
Installing ri documentation for rake-0.8.7...<br />
Installing ri documentation for activesupport-2.3.8...<br />
Installing ri documentation for activerecord-2.3.8...<br />
Installing ri documentation for rack-1.1.0...<br />
Installing ri documentation for actionpack-2.3.8...<br />
Installing ri documentation for actionmailer-2.3.8...<br />
Installing ri documentation for activeresource-2.3.8...<br />
Installing ri documentation for rails-2.3.8...<br />
Installing RDoc documentation for rake-0.8.7...<br />
Installing RDoc documentation for activesupport-2.3.8...<br />
Installing RDoc documentation for activerecord-2.3.8...<br />
Installing RDoc documentation for rack-1.1.0...<br />
Installing RDoc documentation for actionpack-2.3.8...<br />
Installing RDoc documentation for actionmailer-2.3.8...<br />
Installing RDoc documentation for activeresource-2.3.8...<br />
Installing RDoc documentation for rails-2.3.8...</code></p>
<p>Next I installed sqlite3</p>
<p><a href="http://www.sqlite.org/sqlite-3_6_10.zip">sqllite command line tool</a><br />
<a href="http://www.sqlite.org/sqlitedll-3_6_10.zip">sqllite dll</a></p>
<p>I unzipped them and put them in the C:\Ruby186\bin\ directory.  Back to the command line, I typed:</p>
<p><code>C:\Ruby186&gt;gem install sqlite3-ruby<br />
Successfully installed sqlite3-ruby-1.3.0-x86-mingw32<br />
1 gem installed<br />
Installing ri documentation for sqlite3-ruby-1.3.0-x86-mingw32...</p>
<p>Enclosing class/module 'mSqlite3' for class Statement not known</p>
<p>No definition for libversion<br />
Installing RDoc documentation for sqlite3-ruby-1.3.0-x86-mingw32...</p>
<p>Enclosing class/module 'mSqlite3' for class Statement not known</p>
<p>No definition for libversion</code></p>
<p>And that&#8217;s it.  Ruby, rails, and sqllite3 are installed.</p>
<br />Filed under: <a href='http://dkrails.wordpress.com/category/tenthhole/'>TenthHole</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=30&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2010/06/13/installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>
	</item>
		<item>
		<title>Create Player Model</title>
		<link>http://dkrails.wordpress.com/2008/06/04/create-player-model/</link>
		<comments>http://dkrails.wordpress.com/2008/06/04/create-player-model/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 03:10:36 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[TenthHole]]></category>
		<category><![CDATA[golf]]></category>
		<category><![CDATA[league]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=21</guid>
		<description><![CDATA[I have a Tenthhole project and an empty MySQL database. Now let&#8217;s start putting stuff in it. First, generate a model for players This creates some stuff, like an empty model named player.rb and, most notably, a database migration Here&#8217;s the migration. Then, I make the magic happen This update MySQL, which now looks like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=21&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have a Tenthhole project and an empty MySQL database.  Now let&#8217;s start putting stuff in it.  First, generate a model for players</p>
<p><a href="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel1.gif"><img src="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel1.gif?w=300&#038;h=104" alt="" width="300" height="104" class="alignnone size-medium wp-image-26" /></a></p>
<p>This creates some stuff, like an empty model named player.rb and, most notably, a database migration</p>
<p><a href="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel2.gif"><img src="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel2.gif?w=300&#038;h=129" alt="" width="300" height="129" class="alignnone size-medium wp-image-23" /></a></p>
<p>Here&#8217;s the migration.</p>
<p><a href="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel4.gif"><img src="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel4.gif?w=300&#038;h=181" alt="" width="300" height="181" class="alignnone size-medium wp-image-25" /></a></p>
<p>Then, I make the magic happen</p>
<p><a href="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel3.gif"><img src="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel3.gif?w=300&#038;h=101" alt="" width="300" height="101" class="alignnone size-medium wp-image-24" /></a></p>
<p>This update MySQL, which now looks like this</p>
<p><a href="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel5.gif"><img src="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel5.gif?w=300&#038;h=85" alt="" width="300" height="85" class="alignnone size-medium wp-image-27" /></a></p>
<p>Next post I&#8217;ll set up the scaffolding.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dkrails.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dkrails.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=21&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2008/06/04/create-player-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>

		<media:content url="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel1.gif?w=300" medium="image" />

		<media:content url="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel2.gif?w=300" medium="image" />

		<media:content url="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel4.gif?w=300" medium="image" />

		<media:content url="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel3.gif?w=300" medium="image" />

		<media:content url="http://dkrails.files.wordpress.com/2008/06/thgenplayermodel5.gif?w=300" medium="image" />
	</item>
		<item>
		<title>Make TenthHole Database</title>
		<link>http://dkrails.wordpress.com/2008/06/04/make-tenthhole-database/</link>
		<comments>http://dkrails.wordpress.com/2008/06/04/make-tenthhole-database/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 02:46:08 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[TenthHole]]></category>
		<category><![CDATA[golf]]></category>
		<category><![CDATA[league]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=17</guid>
		<description><![CDATA[I&#8217;ve created a new rails project and now I need a mysql database. I open up phpMyAdmin (right click on the Instant Rails icon, Configure, Database) and create a new database named Tenthhole_development. I know what to name it because I look in the config/database.yml file. Here&#8217;s what it looks like in phpMyAdmin After I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=17&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a new rails project and now I need a mysql database.  I open up phpMyAdmin (right click on the Instant Rails icon, Configure, Database) and create a new database named Tenthhole_development.  I know what to name it because I look in the config/database.yml file.</p>
<p><a href="http://dkrails.files.wordpress.com/2008/06/thmakedatabase.gif"><img src="http://dkrails.files.wordpress.com/2008/06/thmakedatabase.gif?w=300&#038;h=232" alt="" width="300" height="232" class="alignnone size-medium wp-image-18" /></a></p>
<p>Here&#8217;s what it looks like in phpMyAdmin</p>
<p><a href="http://dkrails.files.wordpress.com/2008/06/thmakedatabase2.gif"><img src="http://dkrails.files.wordpress.com/2008/06/thmakedatabase2.gif?w=300&#038;h=119" alt="" width="300" height="119" class="alignnone size-medium wp-image-19" /></a></p>
<p>After I hit create, I have a database with no tables in it</p>
<p><a href="http://dkrails.files.wordpress.com/2008/06/thmakedatabase3.gif"><img src="http://dkrails.files.wordpress.com/2008/06/thmakedatabase3.gif?w=300&#038;h=116" alt="" width="300" height="116" class="alignnone size-medium wp-image-20" /></a></p>
<p>Next post, I&#8217;ll start creating models.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dkrails.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dkrails.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=17&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2008/06/04/make-tenthhole-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>

		<media:content url="http://dkrails.files.wordpress.com/2008/06/thmakedatabase.gif?w=300" medium="image" />

		<media:content url="http://dkrails.files.wordpress.com/2008/06/thmakedatabase2.gif?w=300" medium="image" />

		<media:content url="http://dkrails.files.wordpress.com/2008/06/thmakedatabase3.gif?w=300" medium="image" />
	</item>
		<item>
		<title>Create Tenthhole Project</title>
		<link>http://dkrails.wordpress.com/2008/06/04/create-tenthhole-project/</link>
		<comments>http://dkrails.wordpress.com/2008/06/04/create-tenthhole-project/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 02:30:10 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[TenthHole]]></category>
		<category><![CDATA[golf]]></category>
		<category><![CDATA[league]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=15</guid>
		<description><![CDATA[I&#8217;m using RadRails and Aptana Studio Community Edition (free). I&#8217;m also using Instant Rails &#8211; yeah I&#8217;m a Windows guy. I have the 2.0 Instant Rails on one computer and whatever the previous version was on another computer. I think the one on this computer is pre-2.0, but i don&#8217;t know how to tell. I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=15&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using RadRails and Aptana Studio Community Edition (free).  I&#8217;m also using Instant Rails &#8211; yeah I&#8217;m a Windows guy.  I have the 2.0 Instant Rails on one computer and whatever the previous version was on another computer.  I think the one on this computer is pre-2.0, but i don&#8217;t know how to tell.  I tried to follow a tutorial <a href="http://skionrails.wordpress.com/tutorials/how-to-write-a-blog-in-15-minutes/">here</a> that uses Rails 2.0 and I ran into some problems.  It could be that I just don&#8217;t know what I&#8217;m doing, but I think it&#8217;s because I&#8217;m using pre-2.0.</p>
<p>I&#8217;m going to create a rails app for a golf league.  The league consists of ten two-man teams playing nine holes once per week.  There are additional players that can sub for any team.  There are two complicated calculations that I have to worry about.  The first is handicap.  The second is score.</p>
<p>Handicap is calculated as the average of the best x scores of the last y scores, where x and y are</p>
<p>1 of 2</p>
<p>2 of 3</p>
<p>3 of 4</p>
<p>3 of 5</p>
<p>If the player only as one score, 80% of that differential (from par) is the handicap.</p>
<p>Scoring goes like this: The lower handicap player (LH) from team A plays the lower handicap player from team B.  There are 21 total points available per week.  The LH paring plays 9 hole match play for 1 point per hole (9 points).  The higher handicap (HH) paring plays 9 hole match play for 1 point per hole (9 points).  Each pairing also plays adjusted stroke play (points 19 and 20).  Then the two teams play adjusted stroke play on their combined score for the final point.</p>
<p>Here&#8217;s my preliminary try at models:</p>
<p>Teams<br />
-name</p>
<p>Players<br />
-name<br />
-email</p>
<p>Courses<br />
-name<br />
-hole1par<br />
-hole1handicap<br />
-hole2par<br />
-hole2handicap<br />
&#8230;<br />
-hole9handicap</p>
<p>Matches<br />
-Date<br />
-Course<br />
-Team<br />
-Player<br />
-Hole<br />
-Score</p>
<p>In Aptana, File &gt; New</p>
<p><a href="http://dkrails.files.wordpress.com/2008/06/thnewproject.gif"><img class="alignnone size-medium wp-image-16" src="http://dkrails.files.wordpress.com/2008/06/thnewproject.gif?w=253&#038;h=300" alt="" width="253" height="300" /></a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dkrails.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dkrails.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=15&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2008/06/04/create-tenthhole-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>

		<media:content url="http://dkrails.files.wordpress.com/2008/06/thnewproject.gif?w=253" medium="image" />
	</item>
		<item>
		<title>Datestamp the Cart</title>
		<link>http://dkrails.wordpress.com/2008/02/26/datestamp-the-cart/</link>
		<comments>http://dkrails.wordpress.com/2008/02/26/datestamp-the-cart/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 01:36:16 +0000</pubDate>
		<dc:creator>Dick</dc:creator>
				<category><![CDATA[Agile Web Development with Rails]]></category>

		<guid isPermaLink="false">http://dkrails.wordpress.com/?p=13</guid>
		<description><![CDATA[Since the cart is just an order with a flag set and it lives in the database, I&#8217;ll need some way to clear out old orders. Visitors will create carts and abandon them and they&#8217;d live there forever if I don&#8217;t do some maintenance. I don&#8217;t know how or when I&#8217;ll do that maintenance, but [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=13&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Since the cart is just an order with a flag set and it lives in the database, I&#8217;ll need some way to clear out old orders.  Visitors will create carts and abandon them and they&#8217;d live there forever if I don&#8217;t do some maintenance.  I don&#8217;t know how or when I&#8217;ll do that maintenance, but I know I&#8217;ll need a date in the cart to determine how old it is.  I start by adding a field to the table.  In a new migration called 008_add_last_access_date.rb:</p>
<pre>class AddLastAccessDate &lt; ActiveRecord::Migration
  def self.up
    add_column :orders, :last_access, :datetime
  end

  def self.down
    remove_column :orders, :last_access
  end
end</pre>
<p>Every time I change the cart, I need to update this field.  In order.rb, I created a new private method</p>
<pre> def update_last_access
   self.last_access = DateTime.now
   self.save
 end</pre>
<p>And I called that in both the add_product and remove_product methods.  I made the method private, but I&#8217;m not sure I needed to.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dkrails.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dkrails.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dkrails.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dkrails.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dkrails.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dkrails.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dkrails.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dkrails.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dkrails.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dkrails.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dkrails.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dkrails.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dkrails.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dkrails.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dkrails.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dkrails.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dkrails.wordpress.com&amp;blog=2919986&amp;post=13&amp;subd=dkrails&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dkrails.wordpress.com/2008/02/26/datestamp-the-cart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/549471243e0020b9aaa949bd381920bd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Dick</media:title>
		</media:content>
	</item>
	</channel>
</rss>
