small medium large xlarge

22 Mar 2008, 05:22
PerlFan (2 posts)

I am diligently going through the Depot example in the AWDWR 2nd Ed. book. I have made it to the end of section 8.4/p109.

My store_controller.rb and store.rhtml files are pretty much exactly as they are in the files that I downloaded from the website.

My problem?: when I access http://localhost:3000/store/wibble, my browser gets redirected properly, but I never see the error text in flash[:notice] because it is empty for some reason.

I do see the expected messages in the log/development.log file:

Attempt to access invalid product whibble flash[:notice] is now Invalid product [I added this; debug code] Redirected to http://localhost:3000/store

I have modified the store.rhtml file to unconditionally print out flash[:notice] but it is always blank. I am even looking at the HTML source to be sure.

I am at a loss to understand why flash[:notice] is blank. I know very little about Ruby or Rails so I’m not quite sure how this should work and I’m not familiar enough with the system to catch this variable getting reset.

Can anybody offer suggestions as to why this variable might be getting reset?

My environment:

$ ruby -v ruby 1.8.5 (2007-03-13 patchlevel 35) [i386-linux] $ rails -v Rails 1.2.6

I am also using sqlite3, and I have verified that the exception that is getting thrown corresponds to my code.


03 Apr 2008, 21:25
PerlFan (2 posts)

I asked a friend who is way more familiar with Ruby/Rails about this. He suggested that I ensure that my browser was accepting cookies from localhost.

However, in the period of time since I originally posted my query, I kindof gave up on getting flash[:notice] to ever work. I also totally upgraded my Linux box to Fedora8, and, in the process, I ended up with a slightly newer copy of Firefox ( – I still had the same $HOME/.mozilla directory though.

So, I took my friend’s suggestion to check for my browser’s cookie preferences. This yielded nothing.

However, I tried this again (with “ruby script/server” running on an old, unupgraded machine and my browser running on my new Fedora 8 box) and now I can see the flash[:notice] message!

I really don’t understand why this would be so, but now it works.

Reminder: I couldn’t see the desired output in the HTML source in my old browser and I have the same $HOME/.mozilla directory as I did before the upgrade. So, I can’t begin to understand why this works.

I guess I’ll just accept that it works and be thankful for this.

You must be logged in to comment