Rails, OpenID, XRDS, and Especially Yahoo!

When setting up OpenID (using AuthLogic), I ran into this problem when logging in with a Yahoo ID:
"Warning: Yahoo! cannot verify this website. We recommend you do not share any personal information with this website."
Andrew's writeup goes into the details of why that's occurring, and below is the solution I used: A dynamic XRDS template. Though a static document would have been nice, I needed something more flexible because my users might arrive on any of a number of different subdomains (i.e. user.mydomain.com, mydomain.com, www.mydomain.com). The four steps are:
  1. Set a META tag in the head of whichever layout is going to be used to render requests for your domain root.
  2. Adjust the controller action that responds to requests for the root (set in routes.rb with a line like map.root) to set an X-XRDS-Location header when responding, and add a yadis action (but don't cache it!).
  3. Add a yadis.xml.erb file into app/views/controller_name.
  4. Add the route to connect requests to /yadis.xml to your erb template.