Rails 1.2.2: SQLite3, gems, singular resources

It's time for another minor update to Rails 1.2. This was primarily prompted by a change in the API for SQLite between version 3.3.7 and 3.3.8+, which left the Rails database adapter for dead by the road side. But with this release and Jamis Buck's sqlite3-ruby gem at version 1.2.1, we're back in business on all versions of SQLite3.

Second, we're now depending on RubyGems 0.9.0 and above. This will fix the deprecation messages for require_gem (the new method is just gem) and will restore rake rails:freeze:gems to working order. So be sure to update to the latest RubyGems before installing. That's done with "gem update --system".

Finally, we've decided to throw in a few goodies along with the fixes described above and the rest of the bug reparations in this release. Singular resources, for example, allow you to model singleton resources within the scope of the domain. The common example is user.application.com/account. That's now modeled with:

  map.resource :account

...and routes accordingly:

  GET /account => AccountController#show   GET /account/new => AccountController#new   GET /account;edit => AccountController#edit   POST /account => AccountController#create   PUT /account => AccountController#update   DELETE /account => AccountController#destroy

Note that the controller is also singular, not plural as is usually the case when using map.resources.

We've also brought over the enhancement to :conditions in Active Record that'll allow you to pass in ranges and get them automatically converted to BETWEEN statements. Like:

  Student.find(:all, :conditions => { :grade => 9..12 })

...which then becomes:

  "SELECT * FROM students WHERE grade BETWEEN 9 AND 12"

This is a recommended upgrade for everyone running 1.2.x (and a reminder that if you're not yet on Rails 1.2.x, you won't be getting bug fixes automatically and have to backport them yourself). It's a drop-in replacement requiring no changes to applications running 1.2.x.


How about a tag in the repository so we can freeze it?


Never mind, it's there.

Is this correct?

rake rails:freeze:edge TAG=rel_1-2-2

Is this correct?

rake rails:freeze:edge TAG=rel_1-2-2

Works for me.


I upgraded and ran into a routing error. I have this in my routes.rb:

map.resources :campaigns, :collection => { :pause => :post, :resume => :post, :destroy => :delete }

Before 1.2.2, that meant I could do (in console):

app.destroy_campaigns_path => “/campaigns;destroy”

Now it that throws an error: ActionController::RoutingError: destroy_campaigns_url failed to generate from {:controller=>“campaigns”, :action=>“destroy”}, expected: {:controller=>“campaigns”, :action=>“destroy”, :id=>/[^/;.,?]+/}, diff: {:id=>/[^/;.,?]+/}

If I pass it an :id, it works, but doesn’t even use the :id

app.destroy_campaigns_path :id => 1 => “/campaigns;destroy”

What is the point of that? Is it supposed to be that way and, if so, then how can I do a collection delete?


I upgraded from Rails 1.2.1 and got the following error:

Updating installed gems... Bulk updating Gem source index for: http://gems.rubyforge.org Attempting remote update of rails Successfully installed rails-1.2.2 Successfully installed activesupport-1.4.1 Successfully installed activerecord-1.15.2 Successfully installed actionpack-1.13.2 Successfully installed actionmailer-1.3.2 Successfully installed actionwebservice-1.2.2 Installing ri documentation for activesupport-1.4.1... Installing ri documentation for activerecord-1.15.2... /usr/local/lib/ruby/1.8/rdoc/parsers/parse_rb.rb:1272: [BUG] Segmentation fault ruby 1.8.5 (2006-08-25) [powerpc-darwin8.8.0]

Abort trap

When I typed rails -v, I got Rails 1.2.2. All my tests passed.

Does the error message cause any problems? Can someone please help? TIA.