Browser detection

is there anyway to do browser detection with rails alone? I know of the
user_agent thing, but I’ve been told that that’s not a good way to do
it. What is the best way without having to code a bunch of other stuff