Finding software versions below a given version

I know there must be a Rails way to do this. A little help?

I have 4 columns in the database (MySQL) holding application version
info (split from a delimited string like “2.6.50:1200” that always has
all parts). I can sort it easily in the way I’m thinking:

@versions = Version.find(:all, :order => “app_major, app_minor,
app_maintenance, app_build”)

But I need to be able to grab all the versions that are BELOW a given
version (which may or may not itself exist in the database). So, if I
have the current version (or whatever version I want to search) in a
hash:

current_app = { :major => 2, :minor => 60, :maintenance => 50, :build =>
1200 }

I can do something crappy like this:

@versions.select { |d|
d.app_major < current_app[:major] or
(d.app_major = current_app[:major] and d.app_minor <
current_app[:minor]) or
(d.app_major = current_app[:major] and d.app_minor =
current_app[:minor] and d.app_maintenance < current_app[:maintenance])
or
(d.app_major = current_app[:major] and d.app_minor =
current_app[:minor] and d.app_maintenance = current_app[:maintenance]
and d.app_build < current_app[:build])
}

but this seems simplistic and not very Rubyish. There has to be a
simple way, right?