Edward’s Notes

Technical topics and photos.

Porting Typo Blog to Rails 2.3.2

After looking at some of the cool features of rails 2.3.2 (like rack integeration) and its claimed compatibility with ruby 1.9.1 I decided to port typo blog 5.3.x from rails 2.2.2. This blog is running on the result of that effort.

I finished the initial port a bit over a month ago but couldn’t deploy it till I updated the varnish_plugin.

Upgrades

  • upgrade rake > 0.8.2
  • upgrade rubygems > 1.3.1
  • upgrade datanoise-actionwebservice = 2.3.2
  • upgrade rspec = 1.2.7, rspec-rails = 1.2.7.1

Problems

Uninitialized Constant ActionController::Caching::Sweeper

Typo was effected by the ”NameErrors (uninitialized constant ActionController::Caching::Sweeper)” bug so I added a patched version of rails 2.3.2 to the repo.

check_box Processing Order Changed.

html checkboxes don’t send any parameter when they are not checked. This causes problems because nothing is sent when a checkbox is unchecked. To solve this problem a hidden field with the same name is placed in the form so that the field is always returned. In rails prior to 2.3.2 the field was placed before the checkbox and the first field was always used, in rails 2.3.2 the last field is always used. This isn’t a problem if you use the checkbox helper but typo manually creates the checkbox and hidden field in some places. I identified the problem after reading Daniel’s comment at the end of the rails 2.3.2 upgrade gotchas post quoted bellow.

I also found that when two params with the same name arrive, the last one now prevails. check_box has inverted its <input><input> to compensate for that, but I got some breakage because I had a control of my own doing something similar.

Daniel

Porting varnish_plugin to 2.3.2

My previous plugin didn’t work under 2.3.2. It monkey patched a purge http method into the base ruby http class and that didn’t work under 2.3.2. I found that I had to add a purge method directly into the rails source to get this to work. I also found

Very useful.

nil account/password login

On certain rails 2.3.2 applications it is possible to login with a nil account name and password. This problem doesn’t seem to effect typo.

References

Comments