惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
S
SegmentFault 最新的问题
量子位
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
博客园 - Franky
Google DeepMind News
Google DeepMind News
Recent Announcements
Recent Announcements
B
Blog RSS Feed
C
Check Point Blog
The Cloudflare Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
V
Visual Studio Blog
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Ruby on Rails: Compress the complexity of modern web apps

Safer to_i coercion, custom to_fs formats, and more! This Week in Rails: May 16, 2026 This Week in Rails: May 8, 2026 This Week in Rails: May 1, 2026 Active Record gets better every week Great big Rails World 2026 update: CFP, Corporate Support tickets, workshops Query command for database queries and more Explicit query: and body: kwargs for integration tests and more! Speedup ActiveRecord::LogSubscriber#sql_color and more! This Week in Rails: March 27, 2026 Rails Versions 8.0.5 and 8.1.3 have been released! Rails Versions 7.2.3.1, 8.0.4.1, and 8.1.2.1 have been released! This Week in Rails: March 20, 2026 Validate URI scheme in Action Text and more This Week in Rails: March 6, 2026 Planning Center is the newest Rails Foundation Contributing member Action Text gets Markdown conversion, editor links in devcontainers, and more! BARRA seeks Rails developer Joe Agliozzo is looking for a Rails developer The rise of lighttpd as the alternative web server When longer is better and more is more Snowdevil: First e-tailer on Rails Natural selection for frameworks in Ruby vs Java Address book tutorial in Portuguese Becoming a better programmer with Rails 10 Things Every Java Programmer Should Know About Ruby Really Getting Started in Rails Off the Treadmill, Onto the Rails Rails 0.9.5: A world of fixes and tweaks Rich clients with Rails and XUL
Rails 2.0.2: Some new defaults and a few fixes
David Heinemeier Hansson · 2007-12-17 · via Ruby on Rails: Compress the complexity of modern web apps

Monday, December 17, 2007
Posted by David

Now that we have the big Rails 2.0 release out the door, it’s a lot easier to push out smaller updates more frequently. So that’s what we’re going to do. Rails 2.0.2 contains a bunch of smaller fixes to various bugs, no show-stopping action, just further polish. But it also contains a few new defaults.

SQLite3 is the new default database

Most importantly is SQLite3 as the new database we’ll configure for by default when you run the rails generation command without any specification. This change comes as SQLite3 is simply an easier out of the box experience than MySQL. There’s no fussing with GRANTs and creates, the database is just there. This is especially so under OS X 10.5 Leopard, which ships with SQLite3 and the driver gems preinstalled as part of the development kit.

If you want to preconfigure your database for MySQL (or any of the other adapters), you simply do “rails -d mysql myapp” and everything is the same as before. But if you’re just playing with a new application or building a smallish internal tool, then I strongly recommend having a look at SQLite3. Thanks to the agnostic db/schema.rb, it’s as easy as changing your config/database.yml to switch from SQLite3 to MySQL (or another database) as soon as your load warrants it.

Don’t check for template changes in production mode

New applications will be generated with the following option in their config/environments/production.rb:

config.action_view.cache_template_loading = true

This will stop Rails from constantly doing STAT calls to the file system to check if the file has changed. This can make for a lot of I/O activity, especially if you have lots of partials. If you have very fast disks, this may not matter, but if you’re running off slower disks it can make quite a big difference.

The drawback is that you can no longer just svnup a single template file and see it changed immediately. You’ll have to restart the application servers to make that happen.

Regardless, we feel that this is the better default in a partial-heavy world, but you’re of course always free to change it.

Rails 2.0.2 is a drop-in replacement for Rails 2.0

To upgrade, just do “gem install rails” (if the gems are still not propagated, use —source http://gems.rubyonrails.org) or use the new rel_2-0-2 tag.

The rest of the changes are as follows:

Action Pack

  • Added delete_via_redirect and put_via_redirect to integration testing #10497 [philodespotos]
  • Allow headers[‘Accept’] to be set by hand when calling xml_http_request #10461 [BMorearty]
  • Added OPTIONS to list of default accepted HTTP methods #10449 [holoway]
  • Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 [chuyeow]. Example:

ActionController::Base.asset_host = Proc.new { |source| if source.starts_with?(‘/images’) “http://images.example.com” else “http://assets.example.com” end }

  • Fixed that ActionView#file_exists? would be incorrect if @first_render is set #10569 [dbussink]
  • Added that Array#to_param calls to_param on all it’s elements #10473 [brandon]
  • Ensure asset cache directories are automatically created. #10337 [Josh Peek, Cheah Chu Yeow]
  • render :xml and :json preserve custom content types. #10388 [jmettraux, Cheah Chu Yeow]
  • Refactor Action View template handlers. #10437, #10455 [Josh Peek]
  • Fix DoubleRenderError message and leave out mention of returning false from filters. Closes #10380 [Frederick Cheung]
  • Clean up some cruft around ActionController::Base#head. Closes #10417 [ssoroka]

Active Record

  • Ensure optimistic locking handles nil #lock_version values properly. Closes #10510 [rick]
  • Make the Fixtures Test::Unit enhancements more supporting for double-loaded test cases. Closes #10379 [brynary]
  • Fix that validates_acceptance_of still works for non-existent tables (useful for bootstrapping new databases). Closes #10474 [hasmanyjosh]
  • Ensure that the :uniq option for has_many :through associations retains the order. #10463 [remvee]
  • Base.exists? doesn’t rescue exceptions to avoid hiding SQL errors. #10458 [Michael Klishin]
  • Documentation: Active Record exceptions, destroy_all and delete_all. #10444, #10447 [Michael Klishin]

Active Resource

  • Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek]
  • Correct empty response handling. #10445 [seangeo]

Active Support

  • Ruby 1.9 compatibility. #1689, #10466, #10468 [Cheah Chu Yeow, Pratik Naik, Jeremy Kemper]
  • TimeZone#to_s uses UTC rather than GMT. #1689 [Cheah Chu Yeow]
  • Refactor of Hash#symbolize_keys! to use Hash#replace. Closes #10420 [ReinH]
  • Fix HashWithIndifferentAccess#to_options! so it doesn’t clear the options hash. Closes #10419 [ReinH]

Rails

  • Changed the default database from mysql to sqlite3, so now running “rails myapp” will have a config/database.yml that’s setup for SQLite3 (which in OS X Leopard is installed by default, so is the gem, so everything Just Works with no database configuration at all). To get a Rails application preconfigured for MySQL, just run “rails -d mysql myapp” [DHH]
  • Turned on ActionView::Base.cache_template_loading by default in config/environments/production.rb to prevent file system stat calls for every template loading to see if it changed (this means that you have to restart the application to see template changes in production mode) [DHH]
  • Introduce `rake secret` to output a crytographically secure secret key for use with cookie sessions #10363 [revans]
  • Fixed that local database creation should consider 127.0.0.1 local #9026 [parcelbrat]
  • Fixed that functional tests generated for scaffolds should use fixture calls instead of hard-coded IDs #10435 [boone]
  • Added db:migrate:redo and db:migrate:reset for rerunning existing migrations #10431, #10432 [matt]
  • RAILS_GEM_VERSION may be double-quoted also. #10443 [James Cox]
  • Update rails:freeze:gems to work with RubyGems 0.9.5. [Jeremy Kemper]