rails
Howto upgrade Passenger to 2.0.1
Submitted by specialj on Tue, 2008-06-24 19:06.I noticed that Passenger 2.0.1 became available today and I decided to upgrade a couple of my Rails sites which are using it. The process was painless but there are some configuration changes to note when upgrading from 1.0.x. So here are the steps I took.
Update: I’d also like to confirm that fair load balancing is working properly with Passenger. This is a feature that I have wanted for some time and I’m glad to see it working.
Rails notes from recent work and news
Submitted by specialj on Mon, 2008-06-23 22:39.I’m fairly busy working on a couple of Rails applications. Here are some notes I’ve jotted down in the past few days.
- So there was a security advisory about Ruby that has led to some discussion about the nature of the problems (1, 2). The Phusion folks have offered Ruby Enterprise Edition as a solution to these vulnerabilities by backporting the fixes. I haven’t followed the Debian and Ubuntu package maintainers but I’m interested to see what they come up with.
Recent Ruby Gem updates and releases of interest
Submitted by specialj on Mon, 2008-06-16 18:48.There seems to have been a lot of gem updates and releases recently which is good to see. I’m especially happy with people addressing the problems of BlueCloth with better Markdown processors even though I’m less inclined to use Markdown these days. Anyway, these are all announcements that I think Rails developers should be aware of.
Lessons for Rails: Pay attention to plugins and test everything
Submitted by specialj on Tue, 2008-06-10 18:03.So I had mentioned that I had encountered difficulties with Rails 2.1 partial updates and I was suspicious of it being related to a plugin. Turns out the flextimes plugin was causing partial updates to not work as well as other subtle errors. The plugin was employed simply to enable a 12-hour with am/pm timeselect and selecttime functions. It had worked fine for a long period of time and only really caused problems with partial updates. However, once I started putting more tests into place I found other problems leading me to believe that flextimes probably broke functionality under Rails 2.0, The problem with unmaintained plugins is that they may continue to do their task but create seemingly unrelated problems elsewhere in the code.
Passenger 2.0 on the way
Submitted by specialj on Mon, 2008-06-09 19:07.I’m already sold on Passenger and talked it up a bit at RailsConf. Still the list of features coming for version 2 are impressive and should win over some holdouts still using mongrel+nginx and similar setups. Passenger 2.0 will have Rack support, reduced memory usage, fair load balancing, upload buffering, as well as performance and stability improvements. Release Candidate 1 is available now for testing and I may test though I may just wait for 2.0 to be released and upgrade my systems then. More information can be found in the Passenger RC1 Annoucement.
Rails 2.1 Bugs: Partial Updates Failure
Submitted by specialj on Mon, 2008-06-09 19:03.My first web application upgraded to Rails 2.1 completely broke due to partial updates. For some reason, which I’m certainly willing to consider is some plugin or custom code, none of my changed objects ever reported that they were changed. And thus everytime an object was saved no new information was actually placed into the database. I’ve fixed the application by disabling partial updates with “ActiveRecord::Base.partial_updates = false” in environment.rb. Maybe in the future I’ll look into this issue further. Or perhaps I’ll wait for someone else to find it, resolve it, and simply copy the fix. It’s not a feature I need though it would be nice to have.
Update: It seems as though the problem was due to the flextimes plugin. I documented my discovery, changes, and lessons learned in Lessons for Rails: Pay attention to plugins and test everything.
Fixing IE6 PNG transparency in Rails applications
Submitted by specialj on Sat, 2008-06-07 04:32.I’m a fan of using IE6’s behaviors to fix PNG transparency (PNG Behavior, IE PNG Fix). Unfortunately the scripts that I’ve used do not work out of the box for Rails because of Rails appending a timestamp to the end of the PNG files. To fix this the behavior files need to be updated with a better regular expression for detecting these PNG file requests. It’s not difficult to do once you figure out that is what the problem is.
strftime cheatsheet
Submitted by specialj on Sat, 2008-06-07 04:11.I know there are other cheatsheets out there but I want one that’s close to home. I find myself needing to look up strftime parameters quite often in my Rails development work. Particularly difficult is remembering the different forms for the same time item. Anyway, here is a list formatted for my usage.
Capistrano recipes for deploying to Passenger
Submitted by specialj on Sat, 2008-06-07 03:11.I did a search for recipes to handle starting/restarting Passenger rails applications. I cam across this dzone snippet that I felt had the right approach. It creates a mod_rails:restart task and then overrides the deploy:start and deploy:restart tasks with a call to that task. This not only accomplishes restarting properly but also removes the default deploy:restart task which is not applicable.
Rails 2.1 Features: Change in find :include behavior
Submitted by specialj on Mon, 2008-06-02 20:45.Interesting enough someone had mentioned this change to me over breakfast today but it was the first I had heard of it. That’s unfortunate because it was a change that ended up breaking my code. The jist of it is that when using an include parameter for finds Rails no longer just creates a join query. I agree that this is advantageous is many situations that are common for Rails apps but it neglects when you actually want to have a condition for the joined table. Thankfully it’s not too difficult to get the original behavior back by simply qualifying the column with its table name. I found some helpful details from these posts:
Update: The pluralization is tricky on these. The include must be the name of the association which is plural for has_many and singular for belongs_to. However the qualification must be the table name which is plural. Here is an example.
Rails 2.1 Migration Bugs: BenchmarkForRails
Submitted by specialj on Mon, 2008-06-02 20:07.Upon updating an application to Rails 2.1 the first bug I saw prevented the application from loading due to the BenchmarkForRails plugin. Here's how I fixed it.
Rails 2.1 released
Submitted by specialj on Mon, 2008-06-02 02:17.So Rails 2.1 is released. Here are some quick thoughts:
- Even with a newer version of gems memory requirements for the upgrade can be hefty. On virtual servers with 512MB of RAM it is best to stop the app and web server instances before installing the new version.
- I’m looking forward to phasing out scope_out present in 1 or 2 apps with named_scope (aka has_finder).
- There have been times in the past where I had much need for gem dependencies but not so much these days. Still a nice feature to have available.
- I’m really interested in playing with the dirty tracking/partial updates. I’m not sure they’ll make a lot of difference in any of my apps but it’s worth testing.
Installing rubygems and libgems-ruby 1.1.1 in Ubuntu
Submitted by specialj on Tue, 2008-05-27 18:53.Although this version of rubygems should show up in hardy-backports I’m not sure it will ever be ported to gutsy-backports. So I decided to pull the new version and install it on my Ubuntu 7.10 (Gutsy Gibbon) systems. I had previously been using 1.0.1 from Debian testing. The steps to install were quite simple. This should work for at least ubuntu 7.10 and 8.04 and perhaps other versions as well.
Some Rails Tidbits
Submitted by specialj on Fri, 2008-05-16 03:59.I’ve been doing a lot of rails development recently and wanted to write some thoughts:
- I forgot that it was buttonto not buttonfor and button_to is really quite useful.
- I came across 2 rails-based shopping cart projects: substruct and Spree.
- I found rails-fast-sessions (also FastSessions Rails Plugin Released) which looks like a likely candidate to supersede SqlSessionStore.
- Masquerade is a Ruby on Rails OpenID server.
Upgrading Passenger (mod_rails) to 1.0.5
Submitted by specialj on Sun, 2008-05-11 16:09.A changelog for the recent versions of Passenger (1.0.3-1.0.5) was recently posted. I decided to do a quick upgrade to 1.0.5 following the steps I’ve used previously. Those steps are documented as follows.
Upgrading Passenger (mod_rails) to 1.0.4
Submitted by specialj on Sat, 2008-05-03 15:35.I’ve been evaluating Passenger for a while now and I’ve generally been pleased. I find that an Apache + Passenger setup has been easier to manage than alternative Rails stacks. Performance has been good and memory consumption has been lessened which also helps performance on the systems in general. However I have seen some strange bugs while using my web apps under Passenger. I am hoping that this upgrade will resolve these issues. The upgrade was relatively easy and the steps I took follows.
Visualizing a rails application using Railroad on Ubuntu or Debian
Submitted by specialj on Thu, 2008-04-24 18:42.I wanted to finally explore the various tools for creating graphs of Rails models. I’ve been wanting to do so for a while because such graphs can really help when developing an application. I really wanted something that was a gem and not a plugin and I found that Railroad was just what I was looking for. Rails Application Visualizer seems to have been abandoned and is a plugin and Visualize Models is also a plugin. Here’s how I installed and used Railroad.
Installing Passenger Rails stack on Ubuntu 7.10 (Gutsy Gibbon)
Submitted by specialj on Sun, 2008-04-13 23:32.Just a few days ago Passenger was released in order to better integrate Rails with Apache. I decided to give it a try as I see it being very useful to simplify Rails deployments. I was also interested in testing the performance compared to nginx and mongrel.
Installing a Rails Stack on Ubuntu 7.10 (Gutsy Gibbon)
Submitted by specialj on Wed, 2008-04-09 16:45.I setup a virtual server for a client to host a Rails application on an Ubuntu 7.10 system. Here I have documented the steps to install all the necessary pieces of software. This is a MySQL5.0/Rails2.0/Mongrel1.1/Apache2.2 setup with Subversion for source code management. I realize that Apache is not the most popular frontend but for this client security and maturity are important. I also realize that their are alternatives to Mongrel, MySQL, and Subversion as well that are well worth considering. So rather than this being THE Rails stack I think of it as A Rails stack suited for a particular customer.
Wrestling with Monit and Mongrel
Submitted by specialj on Wed, 2008-03-12 01:02.Many people, including myself, have had difficulty in getting Monit to properly stop and start mongrel processes. The problem stems from the fact that Monit restricts the PATH environment variable such that it does not work with the mongrel_rails cluster::* commands. I decided to investigate this issue to find a workable solution.




Recent comments
2 weeks 4 days ago
3 weeks 2 days ago
8 weeks 3 days ago
8 weeks 4 days ago
8 weeks 4 days ago
9 weeks 2 days ago
9 weeks 2 days ago
10 weeks 1 day ago
10 weeks 1 day ago
10 weeks 1 day ago