To display LaTeX for the web, it seems to me that it mathTeXis the application of choice. There are many other options, all of which seem to be based on dvipnghow the foundation is. mathTeXseems to be the most polished and capable, and easy to configure as a CGI service, so your Rails application can generate regular HTML tags <img>with fairly complex attributes src.
EDIT: mathTeX, , , Linux - , . , . .