i did not test that out, but i think from what you linked to in the ActiveAdmin generator it might work like this:
inject_into_file "config/routes.rb", " do_stuff(foo)\n", :before => /^end/
this should insert your code right before an end
token that starts at the beginning of a line. this only works for properly formatted routes files though....