<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Beginning Rails - Home</title>
  <id>tag:beginningrails.com,2008:mephisto/</id>
  <generator version="0.7.3" uri="http://mephistoblog.com">Mephisto Noh-Varr</generator>
  <link href="http://beginningrails.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://beginningrails.com/" rel="alternate" type="text/html"/>
  <updated>2007-12-18T16:10:27Z</updated>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-12-18:27</id>
    <published>2007-12-18T16:09:00Z</published>
    <updated>2007-12-18T16:10:27Z</updated>
    <link href="http://beginningrails.com/2007/12/18/a-note-about-rails-versions" rel="alternate" type="text/html"/>
    <title>A Note About Rails Versions</title>
<content type="html">
            &lt;p&gt;As some of you may be aware, &lt;a href=&quot;http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done&quot;&gt;Rails 2.0 was recently released&lt;/a&gt;. This is a huge milestone for the Rails project, but it introduces a few changes that are sure to trip up readers.&lt;/p&gt;


	&lt;h3&gt;The book was written for Rails version 1.2.3&lt;/h3&gt;


	&lt;p&gt;That&#8217;s right. When the book was written, Rails 2.0 was merely a glint in the core team&#8217;s eye.&lt;/p&gt;


	&lt;p&gt;Generally, a release that increments the major version number (as in Rails 1.x to 2.0) will include breaking changes, and Rails 2.0 is no exception. With this latest release, the core team has been really aggressive in terms of removing features. Some of the nice-to-have features like scaffolding and pagination that we wrote about in the book are no longer part of the core framework but are available as plugins instead.&lt;/p&gt;


	&lt;h3&gt;Installing and using Rails 1.2.3&lt;/h3&gt;


	&lt;p&gt;If you want your sailing to be smooth, &lt;strong&gt;I recommend installing and using Rails 1.2.3 as you go through the examples in the book&lt;/strong&gt;. Here&#8217;s how you would go about installing version 1.2.3 via RubyGems and telling your application to use it:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;&lt;code&gt;sudo gem install rails -v 1.2.3&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;open &lt;code&gt;config/environment.rb&lt;/code&gt; and make sure the &lt;code&gt;RAILS_GEM_VERSION&lt;/code&gt; is set to &lt;code&gt;1.2.3&lt;/code&gt;:&lt;/li&gt;
	&lt;/ol&gt;


&lt;pre&gt;
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '1.2.3'
&lt;/pre&gt;

	&lt;p&gt;You&#8217;ll no longer need to worry about installing the scaffolding or pagination plugins because they&#8217;re both alive and well in Rails 1.2.3.&lt;/p&gt;


	&lt;p&gt;You can also elect to freeze a copy of Rails into your project&#8217;s vendor directory, which will take precedence over the Gem version you&#8217;ve specified. Rails makes this easy with a bundled Rake tasks:&lt;/p&gt;


&lt;pre&gt;
$ rake -T | grep freeze
rake rails:freeze:edge  # Lock to latest Edge Rails or a specific revision with REVISION=X
rake rails:freeze:gems  # Lock this application to the current gems (by unpacking into vendor/rails)
rake rails:unfreeze     # Unlock this application from freeze of gems or edge and return to a fluid use of system gems
&lt;/pre&gt;

	&lt;p&gt;As you can see from the comments, you can freeze to either the edge version of Rails, or a specific revision from the repository. You can also freeze to whatever Gem version of Rails you have installed on your system.&lt;/p&gt;


	&lt;p&gt;This is often called the &lt;a href=&quot;http://errtheblog.com/posts/50-vendor-everything&quot;&gt;vendor everything&lt;/a&gt; approach.&lt;/p&gt;


	&lt;h3&gt;What about the future?&lt;/h3&gt;


	&lt;p&gt;Take heart. Most of the changes are minor enough that you won&#8217;t have any trouble transferring your knowledge to Rails 2.0. By the time you&#8217;ve finished the book, you&#8217;ll have a much better understanding of Rails, and to be sure, the fundamentals haven&#8217;t changed.&lt;/p&gt;


	&lt;p&gt;The new and refined features of Rails 2.0 have only made it better.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-12-11:13</id>
    <published>2007-12-11T19:37:00Z</published>
    <updated>2007-12-11T19:42:21Z</updated>
    <link href="http://beginningrails.com/2007/12/11/problem-pagination" rel="alternate" type="text/html"/>
    <title>Problem: pagination</title>
<content type="html">
            &lt;p&gt;On page 172 of the book, we talk about Pagination. Pagination is a good thing. As a rule, don&#8217;t return more results from the database than you need to for a given purpose.&lt;/p&gt;


	&lt;p&gt;In the sample application, we use Rails&#8217; built-in Paginator, but with the caveat that it might be slated for future removal from the framework. Alas, that day has come. In Rails 2.0, pagination is no more. Why? Well, as I mentioned in the book, a lot of folks feel that pagination is too domain-specific to be part of the framework.&lt;/p&gt;


	&lt;p&gt;You can install the classic_pagination plugin, which is the extracted code from Rails, rolled into a plugin. This is what we used in the book. Installation is the same as for any plugin:&lt;/p&gt;


&lt;pre&gt;./script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination&lt;/pre&gt;

	&lt;p&gt;That&#8217;ll get you up and running with the examples in the book. This has bitten at least one reader already. &lt;a href=&quot;http://groups.google.com/group/beginning-rails/browse_thread/thread/c6f0a57966669e90&quot;&gt;Read up on the thread on the book&#8217;s mailing list&lt;/a&gt;&lt;/p&gt;


	&lt;h2&gt;Enter: will_paginate&lt;/h2&gt;


	&lt;p&gt;Pagination was removed from Rails because it was deemed outside the scope of the framework. This is good. Removing a feature like this is usually a catalyst for the emergence of better alternatives. Out of the handful of pagination plugins currently circulating, my favorite is will_paginate:&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://errtheblog.com/post/4791&quot;&gt;http://errtheblog.com/post/4791&lt;/a&gt;
&lt;a href=&quot;http://require.errtheblog.com/plugins/browser/will_paginate/README?format=txt&quot;&gt;http://require.errtheblog.com/plugins/browser/will_paginate/README?format=txt&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;This is from will_paginate&#8217;s &lt;span class=&quot;caps&quot;&gt;README&lt;/span&gt;:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;# app/controllers/posts_controller.rb

@posts = Post.paginate :page =&amp;gt; params[:page]

# app/views/posts/index.html.erb

&amp;lt;p&amp;gt;Handful of posts coming up&amp;lt;/p&amp;gt;
&amp;lt;%= render :partial =&amp;gt; 'post', :collection =&amp;gt; @posts %&amp;gt;

&amp;lt;p&amp;gt;Now let's render us some pagination!&amp;lt;/p&amp;gt;
&amp;lt;%= will_paginate @posts %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Note that will_paginate&#8217;s interface is different than that of classic pagination, so it&#8217;s not a drop in replacement. Still, if you read the examples in the &lt;span class=&quot;caps&quot;&gt;README&lt;/span&gt;, you should be able to figure it out in no time!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-11-28:24</id>
    <published>2007-11-28T22:28:00Z</published>
    <updated>2007-11-28T22:29:38Z</updated>
    <link href="http://beginningrails.com/2007/11/28/everything-you-need-to-know-about-sessions-and-cookies-in-rails" rel="alternate" type="text/html"/>
    <title>On sessions, cookies, and debugging in Rails</title>
<content type="html">
            &lt;p&gt;To borrow a move from &lt;a href=&quot;http://rubyinside.com&quot;&gt;Ruby Inside&lt;/a&gt;, here are a few Rails tidbits that don&#8217;t need separate posts, but that you&#8217;re likely to find quite useful when learning Rails.&lt;/p&gt;


	&lt;h3&gt;Everything you need to know about sessions and cookies&lt;/h3&gt;


	&lt;p&gt;This article is long. But it&#8217;s the best writeup on sessions and cookies as they pertain to the Rails framework I&#8217;ve yet read.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://www.quarkruby.com/2007/10/21/sessions-and-cookies-in-ruby-on-rails&quot;&gt;http://www.quarkruby.com/2007/10/21/sessions-and-cookies-in-ruby-on-rails&lt;/a&gt;&lt;/p&gt;


	&lt;h3&gt;Debugging Rails applications with ruby-debug&lt;/h3&gt;


	&lt;p&gt;&lt;a href=&quot;http://dev.rubyonrails.org/changeset/6611&quot;&gt;The days of the breakpointer are long behind us&lt;/a&gt;. The new tool on the block is &lt;a href=&quot;http://rubyforge.org/projects/ruby-debug&quot;&gt;ruby-debug&lt;/a&gt;. Thankfully, Patrick Lenz has written the most complete guide to ruby-debug I&#8217;ve seen to date.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://www.sitepoint.com/article/debug-rails-app-ruby-debug&quot;&gt;Debug your Rails app with ruby-debug&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-10-19:23</id>
    <published>2007-10-19T16:32:00Z</published>
    <updated>2007-10-19T16:40:16Z</updated>
    <link href="http://beginningrails.com/2007/10/19/ruby-naming-conventions" rel="alternate" type="text/html"/>
    <title>Ruby Naming Conventions</title>
<content type="html">
            &lt;p&gt;From the &lt;a href=&quot;http://www.softiesonrails.com&quot;&gt;Softies on Rails&lt;/a&gt; comes a quick summary of idiomatic Ruby naming conventions. To a seasoned Rubyist, these are common knowledge, but I&#8217;ve seen many a beginner carrying their baggage from other languages over to Ruby.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://www.softiesonrails.com/2007/10/18/ruby-101-naming-conventions&quot;&gt;Ruby 101: Naming Conventions&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;In the book, I wrote the following sidebar that covers the basics (from page 330):&lt;/p&gt;


	&lt;h3&gt;Ruby Style&lt;/h3&gt;


	&lt;p&gt;Style is important when programming. Ruby programmers tend to be picky about style, and generally adhere to a few specific guidelines:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Indentation size is two spaces &lt;/li&gt;
		&lt;li&gt;Spaces are preferred to tabs &lt;/li&gt;
		&lt;li&gt;Variables should be lowercase and underscored: &lt;code&gt;some_variable&lt;/code&gt;, not &lt;code&gt;someVariable&lt;/code&gt; or &lt;code&gt;somevariable&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;Method definitions should include parentheses and no unnecessary spaces: 
  &lt;code&gt;MyClass.my_method(my_arg)&lt;/code&gt;, not &lt;code&gt;my_method( my_arg )&lt;/code&gt; or &lt;code&gt;my_method my_arg&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Whatever your personal style, the most important thing is that you remain consistent. There&#8217;s nothing worse than looking at code that switches between tabs and spaces, or mixed and lowercase variable names.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-10-04:22</id>
    <published>2007-10-04T19:13:00Z</published>
    <updated>2007-10-04T19:14:09Z</updated>
    <link href="http://beginningrails.com/2007/10/4/beginning-rails-on-sale-at-bookpool" rel="alternate" type="text/html"/>
    <title>Beginning Rails on Sale at Bookpool</title>
<content type="html">
            &lt;p&gt;&lt;a href=&quot;http://www.bookpool.com/.x/ssssss_c615/ct/246/&quot;&gt;Apress is having a huge sale at BookPool this month&lt;/a&gt; – pretty much all their titles are 50% off. This includes, of course, &lt;a href=&quot;http://www.bookpool.com/sm/1590596862&quot;&gt;Beginning Rails&lt;/a&gt;, for the ultra-low price of $17.25. If you&#8217;re thinking about getting into &lt;a href=&quot;http://rubyonrails.org&quot;&gt;Ruby on Rails&lt;/a&gt; and are looking for a great book to get you up and running, now is a great time to take the plunge.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://www.bookpool.com/sm/1590596862&quot;&gt;Beginning Rails at Bookpool&lt;/a&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-09-30:20</id>
    <published>2007-09-30T23:56:00Z</published>
    <updated>2007-09-30T23:56:53Z</updated>
    <link href="http://beginningrails.com/2007/9/30/becoming-an-expert-in-rails-is-hard" rel="alternate" type="text/html"/>
    <title>Becoming an Expert in Rails is Hard</title>
<content type="html">
            &lt;p&gt;&lt;a href=&quot;http://blog.jayfields.com&quot;&gt;Jay Fields&lt;/a&gt; has an insightful article on the fact that, while it&#8217;s relatively easy to get started with Rails, experts aren&#8217;t born overnight.&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;It is easy to learn Rails and quickly become productive. However, the dirty little secret is that it&#8217;s very hard to be come an expert at utilizing Rails.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Reading Beginning Rails will not make you an expert. It will introduce to you the Rails philosophy, and take you through the basics, but in order to build a successful web application using Rails, you need to become proficient in a lot of technologies. Web applications have a lot of moving parts. In addition to learning Ruby, you&#8217;ll need to learn &lt;span class=&quot;caps&quot;&gt;SQL&lt;/span&gt;, JavaScript, Ajax, &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;, and &lt;span class=&quot;caps&quot;&gt;YAML&lt;/span&gt;, and a collection of others. You&#8217;ll also need to learn how to test, and how to debug. If your web application is to become popular, you&#8217;ll need to learn how to scale it in a production environment and how to optimize your database server.&lt;/p&gt;


	&lt;p&gt;There is no shortcut to success here. Mastering web development takes time and effort. Reading a book like Beginning Rails is really only the first of many investments in your knowledge portfolio, something that requires constant investment over time.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://blog.jayfields.com/2007/09/learing-rails-is-easy-mastering-rails.html&quot;&gt;Read the full article at Jay&#8217;s blog here&lt;/a&gt;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-09-28:19</id>
    <published>2007-09-28T14:57:00Z</published>
    <updated>2007-09-28T15:06:05Z</updated>
    <link href="http://beginningrails.com/2007/9/28/raaum-s-rails-reader" rel="alternate" type="text/html"/>
    <title>Raaum's Rails Reader</title>
<content type="html">
            &lt;p&gt;&lt;a href=&quot;http://rails.raaum.org/&quot;&gt;Raaum&#8217;s Rails Reader&lt;/a&gt; is a great resource for beginners and experienced Rails developers alike. It serves a both a manual for Rails and a field guide to help you navigate the wealth of other Rails documentation scattered throughout the web.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://rails.raaum.org/index.html&quot;&gt;http://rails.raaum.org&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Some choice cuts include:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://rails.raaum.org/database-conventions.html&quot;&gt;Database Conventions&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://rails.raaum.org/big-bag-of-tricks.html&quot;&gt;The Big Bag of Tricks&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://rails.raaum.org/activerecord.html&quot;&gt;The Most Complete ActiveRecord Reference I&#8217;ve Ever Seen&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Thanks Raaum!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-09-19:18</id>
    <published>2007-09-19T22:12:00Z</published>
    <updated>2007-10-04T19:14:57Z</updated>
    <link href="http://beginningrails.com/2007/9/19/rails-console-secrets" rel="alternate" type="text/html"/>
    <title>Rails Console Secrets</title>
<content type="html">
            &lt;p&gt;This is an oldish link, but it&#8217;s a good one, especially for those folks who aren&#8217;t yet Rails console ninjas.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://slash7.com/articles/2006/12/21/secrets-of-the-rails-console-ninjas&quot;&gt;Secrets of the Rails Console Ninjas&lt;/a&gt;&lt;/strong&gt; by &lt;a href=&quot;http://slash7.com&quot;&gt;Amy Hoy&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;For the unenlightened, Ruby comes with a an interactive interpreter called irb (for Interactive Ruby). Rails harnesses the power of irb to give you an interactive console for your application (hereafter referred to as simply &#8220;the console&#8221;). The advantage of the console is that it enjoys the special privilege of being fully integrated with your project’s environment. This means it has access and knowledge of your models (and subsequently, your database). You can execute any arbitrary Ruby code inside the console and do anything you might otherwise do inside your Ruby programs: set variables, evaluate conditions, and inspect objects. The only essential difference between an interactive session and a regular old Ruby program is that console will echo the return value of everything it executes. This saves you from having to explicitly print the results of an evaluation. Just run the code, and you&#8217;ll see the results.&lt;/p&gt;


	&lt;p&gt;We use the console pretty heavily in the book, so for the most part, you learn by doing. But there are definitely some tricks here that we didn&#8217;t mention. So, if you&#8217;re wondering about things like:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Specifying console environment (&lt;code&gt;./script/console production&lt;/code&gt;)&lt;/li&gt;
		&lt;li&gt;Getting out of a block of code (&lt;code&gt;ctrl + c&lt;/code&gt;)&lt;/li&gt;
		&lt;li&gt;Accessing the last return value (&lt;code&gt;_&lt;/code&gt;)&lt;/li&gt;
		&lt;li&gt;Reloading the console (&lt;code&gt;reload!&lt;/code&gt;)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Then you should check out Amy&#8217;s article. There&#8217;s also a collection on Stupid console tricks!&lt;/p&gt;


	&lt;p&gt;For further reading, check out Chris Wanstrath&#8217;s classic article &lt;a href=&quot;http://errtheblog.com/post/26&quot;&gt;irb Mix Tape&lt;/a&gt;, which is full of other amazing goodies that will make your day.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-09-11:17</id>
    <published>2007-09-11T17:40:00Z</published>
    <updated>2007-09-11T17:40:55Z</updated>
    <link href="http://beginningrails.com/2007/9/11/source-code-and-errata-updated" rel="alternate" type="text/html"/>
    <title>Source code and errata updated</title>
<content type="html">
            &lt;p&gt;I&#8217;ve updated (and corrected) the source code for the book.&lt;/p&gt;


	&lt;p&gt;At the request of readers, I&#8217;ve now included the individual code listings for each chapter (previously, I&#8217;d included only the finished, sample application in its entirety). In addition to the app, the code archive now contains all the listings, (named for their listing numbers and filename), divided into directories by chapter. So, if you&#8217;re looking for Listing 3-5 from Chapter 3, you&#8217;ll find it in &lt;code&gt;chapter03/3-5-event.rb&lt;/code&gt;.  Observe:&lt;/p&gt;


&lt;pre&gt;
j:~/book/source$ ls
README      chapter01   chapter03   chapter05   chapter07   chapter09   chapter11
application chapter02   chapter04   chapter06   chapter08   chapter10

j:~/book/source$ tree chapter03
chapter03
    |-- 3-1-database.yml
    |-- 3-2-001_create_events.rb
    |-- 3-3-001_create_events.rb
    |-- 3-4-events_controller.rb
    |-- 3-5-event.rb
    `-- 3-6-events_controller.rb

0 directories, 6 files
&lt;/pre&gt;

	&lt;p&gt;You get the idea.&lt;/p&gt;


	&lt;p&gt;This should make things &lt;strong&gt;a lot&lt;/strong&gt; easier if you&#8217;re following along with the code in the book. Also note that I&#8217;ve been able to correct all the bugs/typos/errors in the code (which is much more forgiving than print). The errata list is nearly complete too, so if you&#8217;re reading the book you&#8217;ll want to check that out lest you get tripped up by something.&lt;/p&gt;


	&lt;p&gt;The source code and errata will always remain available at these locations:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;/source.zip&quot;&gt;http://beginningrails.com/source.zip&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;/errata.html&quot;&gt;http://beginningrails.com/errata.html&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The permanent links are over there in the sidebar.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-09-05:15</id>
    <published>2007-09-05T22:23:00Z</published>
    <updated>2007-10-04T19:15:03Z</updated>
    <link href="http://beginningrails.com/2007/9/5/dynamic-scaffolding" rel="alternate" type="text/html"/>
    <title>Dynamic Scaffolding and Edge</title>
<content type="html">
            &lt;p&gt;We talk about dynamic scaffolding in Rails starting on page 54, &lt;em&gt;Up and Running with Scaffolding&lt;/em&gt;, but we need to mention something: &lt;a href=&quot;http://dev.rubyonrails.org/changeset/6306&quot;&gt;the dynamic scaffolding we&#8217;re using has been moved out of Rails core and into a plugin&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;Now, don&#8217;t panic. This won&#8217;t affect you if you&#8217;re using the latest stable version of Rails (1.2.3 at the time of this writing), but if you&#8217;re using &lt;a href=&quot;http://wiki.rubyonrails.org/rails/pages/EdgeRails&quot;&gt;edge Rails&lt;/a&gt;, it will.&lt;/p&gt;


	&lt;p&gt;Fortunately, installing the scaffolding plugin couldn&#8217;t be any easier:&lt;/p&gt;


&lt;pre&gt;./script/plugin install scaffolding&lt;/pre&gt;

	&lt;p&gt;The &lt;code&gt;plugin&lt;/code&gt; script tries to look for plugins in certain locations, including the Rails svn &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; (try &lt;code&gt;./script/plugin sources&lt;/code&gt; to see the complete list of sources). If for some reason it fails to find scaffolding by name, you can always use the full path:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;http://svn.rubyonrails.org/rails/plugins/scaffolding&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;If you&#8217;re following along with the book using &lt;a href=&quot;http://wiki.rubyonrails.org/rails/pages/EdgeRails&quot;&gt;edge Rails&lt;/a&gt;, you&#8217;ll need to install this for the examples to work!&lt;/p&gt;


	&lt;p&gt;(I&#8217;m actually a fan of the dynamic scaffolding. I find it useful to be able to tweak my schema and model and play with it before generating boilerplate templates. Actually, I tend to use dynamic scaffolding more that the generated variety. Just my personal preference, though.)&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-09-05:12</id>
    <published>2007-09-05T02:32:00Z</published>
    <updated>2007-10-04T19:15:09Z</updated>
    <link href="http://beginningrails.com/2007/9/5/cheatsheets" rel="alternate" type="text/html"/>
    <title>Cheatsheets</title>
<content type="html">
            &lt;p&gt;I was going through some bookmarks today and I came across a few cheatsheets that I thought would be of interest to readers.&lt;/p&gt;


	&lt;p&gt;First, there&#8217;s &lt;a href=&quot;http://blog.invisible.ch/2006/05/01/ruby-on-rails-reference/&quot;&gt;Jens-Christian Fischer&#8217;s &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; cheatsheet for Rails&lt;/a&gt;. It doesn&#8217;t cover version 1.2, but most of the information is still relevant. When you need to look something up quickly, you can just search the &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt;. Handy.&lt;/p&gt;


	&lt;p&gt;Another Rails cheatsheet I really like is from &lt;a href=&quot;http://www.ilovejackdaniels.com/cheat-sheets/ruby-on-rails-cheat-sheet/&quot;&gt;ilovejackdaniels.com&lt;/a&gt;. It&#8217;s a good quick reference that includes the default directory structure, predefined variables, reserved words, and more. Definitely one to check out.&lt;/p&gt;


	&lt;p&gt;If you&#8217;re looking for a Ruby-only cheatsheet, try &lt;a href=&quot;http://ruby.cenophobie.com/rubycheat.php&quot;&gt;RubyCheat&lt;/a&gt; on for size. And while technically not a cheatsheet, I also find &lt;a href=&quot;http://www.zenspider.com/Languages/Ruby/QuickRef.html&quot;&gt;ZenSpider&#8217;s Ruby QuickRef&lt;/a&gt; pretty useful when the &lt;a href=&quot;http://www.pragmaticprogrammer.com/title/ruby/index.html&quot;&gt;PickAxe&lt;/a&gt; is not handy.&lt;/p&gt;


	&lt;h2&gt;Choice Gem: cheat&lt;/h2&gt;


	&lt;p&gt;Speaking of cheats, one of my favorite Ruby Gems as of late is Chris Wanstrath&#8217;s &lt;a href=&quot;http://cheat.errtheblog.com/&quot;&gt;cheat&lt;/a&gt;.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://cheat.errtheblog.com/&quot;&gt;http://cheat.errtheblog.com/&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;http://errtheblog.com/post/23&quot;&gt;http://errtheblog.com/post/23&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;As with all Ruby Gems, it&#8217;s easy to install:&lt;/p&gt;


&lt;pre&gt;
$ sudo gem install cheat
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed cheat-1.2.1
&lt;/pre&gt;

	&lt;p&gt;Basic usage is straightforward: you run the &lt;code&gt;cheat&lt;/code&gt; program and give it the name of the cheatsheet as an argument. So, if you forget all your MySql commands, you can just run &lt;code&gt;cheat mysql&lt;/code&gt;.&lt;/p&gt;


	&lt;p&gt;Here&#8217;s another example, and one I use all the time&#8212;&lt;code&gt;strftime&lt;/code&gt; (output truncated, of course):&lt;/p&gt;


&lt;pre&gt;
$ cheat strftime
strftime:
    %a - The abbreviated weekday name (``Sun'')
    %A - The  full  weekday  name (``Sunday'')
    %b - The abbreviated month name (``Jan'')
    %B - The  full  month  name (``January'')
    ...
&lt;/pre&gt;

	&lt;p&gt;There are a bunch of Rails-related sheets which you can see by typing &lt;code&gt;cheat rails&lt;/code&gt;. Here&#8217;s the full list:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;radrails_rhtml&lt;/li&gt;
		&lt;li&gt;radrails_ruby&lt;/li&gt;
		&lt;li&gt;rails_console&lt;/li&gt;
		&lt;li&gt;rails_edge&lt;/li&gt;
		&lt;li&gt;rails_request_object&lt;/li&gt;
		&lt;li&gt;rails_reserved_words&lt;/li&gt;
		&lt;li&gt;rails_tasks&lt;/li&gt;
		&lt;li&gt;rails_to_s&lt;/li&gt;
		&lt;li&gt;rails_vim&lt;/li&gt;
		&lt;li&gt;test_spec_rails&lt;/li&gt;
		&lt;li&gt;textmate_rails&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;So, if you&#8217;re trying to check out a working copy of edge rails, but forget the path to the Rails subversion repository, you can quickly type &lt;code&gt;cheat rails_edge&lt;/code&gt; to be reminded.&lt;/p&gt;


	&lt;p&gt;To see all available cheatsheets in a big long list, do this:&lt;/p&gt;


&lt;pre&gt;
$ cheat sheets
All Cheat Sheets:
  arts
  as3_formulas
  ascii
  assertions
  assert_select
  association_methods
  awk
  balloon
  bash
  ...
&lt;/pre&gt;

	&lt;p&gt;Finally, to see more of what you can do with cheat, including examples and useful command line flags, use cheat&#8217;s own cheatsheet:&lt;/p&gt;


&lt;pre&gt;
$ cheat cheat
cheat:
  Hey, welcome to cheat (http://cheat.errtheblog.com).
  Thanks for trying it out. 
  ...
&lt;/pre&gt;

	&lt;p&gt;Happy cheating!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-09-04:16</id>
    <published>2007-09-04T00:05:00Z</published>
    <updated>2007-09-04T00:09:29Z</updated>
    <link href="http://beginningrails.com/2007/9/4/reviewed-on-digital-web" rel="alternate" type="text/html"/>
    <title>Reviewed on Digital Web</title>
<content type="html">
            &lt;p&gt;Matthew Pennell has written a thorough review of &lt;a href=&quot;http://www.apress.com/book/bookDisplay.html?bID=10124&quot;&gt;Beginning Rails&lt;/a&gt; over at &lt;a href=&quot;http://www.digital-web.com/articles/review_beginning_rails/&quot;&gt;Digital Web Magazine&lt;/a&gt;.&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;For a Rails novice, what follows is a series of head-shaking, “That’s cool!” moments, as the book walks you through the basics of developing with Ruby on Rails; using the built-in web server, auto-generating files, finding your way around the interactive console, using the scaffolding feature (which allows you to create an entire database front-end with only one line of code), and creating and managing database migrations are all smoothly covered.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;I&#8217;m a regular reader of Digital Web, so I was happy to see it reviewed there.  But don&#8217;t take my word for it. &lt;a href=&quot;http://www.digital-web.com/articles/review_beginning_rails/&quot;&gt;Read the full review&lt;/a&gt;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-08-28:10</id>
    <published>2007-08-28T02:31:00Z</published>
    <updated>2007-08-28T02:32:13Z</updated>
    <category term="pages"/>
    <link href="http://beginningrails.com/2007/8/28/mailing-list" rel="alternate" type="text/html"/>
    <title>Mailing List</title>
<content type="html">
            &lt;p&gt;Attention Readers! I&#8217;ve set up a mailing list via Google Groups to serve as a support channel for the book:&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;http://groups.google.com/group/beginning-rails&quot;&gt;http://groups.google.com/group/beginning-rails&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;If anyone has any questions or needs any help, subscribe to the list and post away!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-08-14:6</id>
    <published>2007-08-14T19:09:00Z</published>
    <updated>2008-03-05T20:25:49Z</updated>
    <link href="http://beginningrails.com/2007/8/14/unknown-database-bug-in-chapter-2" rel="alternate" type="text/html"/>
    <title>Unknown database bug in Chapter 2</title>
<content type="html">
            &lt;p&gt;Or, Rails without a database.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;I found the first bug in the installation instructions for Beginning Rails&lt;/strong&gt;. If you&#8217;re having trouble running the inaugural application (aptly named &lt;code&gt;hello&lt;/code&gt;), it&#8217;s probably because we forgot to mention that Rails expects a database.&lt;/p&gt;


	&lt;p&gt;Without the &lt;code&gt;hello_development&lt;/code&gt; database, browsing to &lt;code&gt;http://localhost:3000/salutation/hello&lt;/code&gt; will result in something like this:&lt;/p&gt;


&lt;pre&gt;
Mysql::Error (#42000Unknown database 'hello_development'):
/usr/local/lib/ruby/gems/1.8/gems/activerecord/lib/active_record/vendor/mysql.rb:523:in `read'
&lt;/pre&gt;

	&lt;p&gt;In the interest of making apparent the irony, I draw your attention to the first paragraph of the chapter in question:&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;For various reasons, Rails has gained an undeserved reputation of being difficult to install. We want t dispel this myth.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Well, so much for dispelling the myth!&lt;/p&gt;


	&lt;p&gt;Remember how in the installation instructions we said that Rails was downright stubborn about working without a database? Well, we were right. Here Rails is obviously expecting a database called &lt;code&gt;hello_development&lt;/code&gt;, but we didn&#8217;t create one!&lt;/p&gt;


	&lt;h2&gt;There are two ways to fix this problem. You can either:&lt;/h2&gt;


	&lt;ol&gt;
	&lt;li&gt;&lt;strong&gt;make Rails happy by creating the required database&lt;/strong&gt;, or&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;edit Rails&#8217; config file and tell it you&#8217;re not using a database for this application&lt;/strong&gt;&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Creating the database is perhaps the easiest way to go. You can flip ahead a few pages and read up on how it&#8217;s done, starting on page 47. But, if you&#8217;re impatient like I am, (and if you followed the installation instructions), you should be able to create the &lt;code&gt;hello_development&lt;/code&gt; database thusly from the command line:&lt;/p&gt;


&lt;pre&gt;
mysqladmin -uroot create hello_development
&lt;/pre&gt;

	&lt;p&gt;Stop the server using &lt;strong&gt;&lt;span class=&quot;caps&quot;&gt;CTRL&lt;/span&gt;-C&lt;/strong&gt;, and restart it using &lt;strong&gt;&lt;code&gt;ruby script/server&lt;/code&gt;&lt;/strong&gt;. Reload &lt;code&gt;http://localhost:3000/salutation/hello&lt;/code&gt; and see if it works. If it does, great. Let&#8217;s just pretend this little mishap never happened. If it doesn&#8217;t, we&#8217;ll have to edit the config file.&lt;/p&gt;


	&lt;p&gt;Rails&#8217; main config file is located in &lt;code&gt;config/environment.rb&lt;/code&gt;. To configure Rails not to bother with a database, open it up in your text editor of choice and find the (commented out) line that reads:&lt;/p&gt;


&lt;pre&gt;
# config.frameworks -= [ :active_resource, :action_mailer ]
&lt;/pre&gt;

	&lt;p&gt;Remove the comment and modify the line so that it excludes only ActiveRecord.&lt;/p&gt;


&lt;pre&gt;
config.frameworks -= [ :active_record ]
&lt;/pre&gt;

	&lt;p&gt;Again, stop the server using &lt;span class=&quot;caps&quot;&gt;CTRL&lt;/span&gt;-C, and restart it using &lt;code&gt;ruby script/server&lt;/code&gt;. Reload &lt;code&gt;http://localhost:3000/salutation/hello&lt;/code&gt; and all should be well.&lt;/p&gt;


	&lt;p&gt;Apologies for this ironically placed blunder!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://beginningrails.com/">
    <author>
      <name>packagethief</name>
    </author>
    <id>tag:beginningrails.com,2007-08-07:3</id>
    <published>2007-08-07T16:12:00Z</published>
    <updated>2007-08-07T16:19:47Z</updated>
    <link href="http://beginningrails.com/2007/8/7/beginning-rails-what-i-wish-i-knew" rel="alternate" type="text/html"/>
    <title>Starting Rails: what Kalid Azad wishes he'd known</title>
<content type="html">
            &lt;p&gt;I just came across &lt;a href=&quot;http://betterexplained.com/articles/starting-ruby-on-rails-what-i-wish-i-knew/&quot;&gt;Starting Ruby on Rails: What I Wish I Knew&lt;/a&gt; in which Kalid Azid summarizes what to expect from Rails and its relatives, including Rake, &lt;span class=&quot;caps&quot;&gt;IRB&lt;/span&gt;, and &lt;span class=&quot;caps&quot;&gt;YAML&lt;/span&gt;. Also mentioned are various Ruby-isms and Rails-isms that often elude the novice developer.&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;Ruby on Rails is an elegant, compact and fun way to build web applications. Unfortunately, many gotchas await the new programmer. Now that I have a few rails projects under my belt, here’s my shot at sparing you the suffering I experienced when first getting started.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;This is the exact question I asked myself while writing &lt;a href=&quot;http://beginningrails.com&quot;&gt;Beginning Rails&lt;/a&gt;: what do you wish you&#8217;d known when you first started out. So, if you&#8217;re reading the book and are wishing for a concise summary of some of the various gotchas, do yourself a favor and read Kalid&#8217;s article.&lt;/p&gt;
          </content>  </entry>
</feed>
