Previous versions of Rails, I could just...
then in any view, do something like
<%= set_focus_to_id 'user_uid' %>
but this doesn't work in Rails 3.1.x
What is the new preferred method for doing this?
View source (in a browser) and see if you have the prototype.js library loaded. focus() is a Prototype method (unless I'm wrong and it's in jQuery as well) and without the library it won't work.
3.1 switched to jQuery, which annoys me, but there is a gem you can add to put things right again.
One other thing to look at -- is your call to set_focus_to_id appearing (in source) below the element it refers to? If it isn't, then you have to wrap your call in an observer callback, so that you are sure that the DOM is ready and knows about the element you're trying to modify.
If your code is at the bottom of your view, then you should be fine, but if it's above the referenced element, or if it's in a content_for :head block, then you have to do something like this:
//your code here