The following script described in section 21.2 of Agile Web
Development with Rails, Edition 3 behaves differently in Rails
2.3.4 than it did in any prior version of Rails, and in fact,
differently than the current Rails 3.0 head does:
http://media.pragprog.com/titles/rails3/code/e1/routing/config/rout...
In particular, the way this code interacts with the following
predefined routes in Depot changed:
http://media.pragprog.com/titles/rails3/code/depot_t/config/routes.rb
The script actually can run in irb, whereas the book describes
script/console. To see the script/console behavior under irb,
change the initial require statements to: require
'config/environment.rb'.
Again, this behavior is specific to 2.3.4, this worked in Rails
1, and all versions of Rails 2 up to and including 2.3.3. It also
works in 3.0-pre.
The simplest way to reproduce this is as follows:
$ git clone git://github.com/rubys/awdwr.git $ cd awdwr $ ruby
makedepot.rb 6.1-21.2 $ cd work/depot $ irb
../../data/code/e1/routing/config/routes_for_blog.rb $ ruby
script/console <
../../data/code/e1/routing/config/routes_for_blog.rb
Note that when the unmodified script is run under irb the last
line output is:
=> "http://www.example.com/blog/2002"
And when run under script/console the last line output is:
=> "http://www.example.com/blog/show_date?year=2002"