Ruby, Rails, Firefox, Anime, Mac
This week’s report covers changes from 5th May 2008 to 11th May 2008 (the day the corresponding Rails Envy podcast was recorded).
script/dbconsole script has been added that allows you to connect to your database using its console client.
If you needed to connect to your production MySQL database (you better know what you are doing!), for example, you can run
RAILS_ENV=production script/dbconsole or simply
script/dbconsole production (thanks to Ryan Bates for pointing this out!) and it will login to your database server using the command line MySQL client. This also works with the PostgreSQL and SQLite databases.
To use this script in your Rails app, remember to run
rake rails:update:scripts after updating to edge Rails.
This is something that many of us Rails developers have probably come across when writing tests for flash messages being set with
flash.now, myself included. Basically, you couldn’t test the contents of your
flash.now because they were always being emptied before your test could get to them.
# In your controller: flash.now[:notice] = 'You gotta be kidding me!' # In your test: assert_equal 'You gotta be kidding me!', flash.now[:notice] # FAILS because flash.now[:notice] is nil
Andreas Neuhaus took a good look at how it works and figured out how to make testing
flash.now work without resorting to
There isn’t much else of note so far but if you’d like to know every gritty detail, you’d probably want to peruse the Rails commit logs. As always, let me know of any suggestions or how I can improve the Living on the Edge (of Rails) series.