I think Rails had a lot to do with Ruby being the initiator. Rails introduced enough of a paradigm shift with its philosophy of making development fun, and it had a better level of visibility via 37signals than other options (say, Django for example). The fact that it was also the way to do web development in Ruby for quite a while (before Merb, Sinatra, et al) strengthened its position. Django already had to compete with existing web frameworks and so the market was inherently splintered when it came out.
Ruby has also benefitted from folks like the Pragmatic Programmers quickly legitimizing it (and Rails) with a number of books, and you have to give the folks promoting Ruby and Rails a lot of credit for trying to tackle thorny problems (e.g. migrations, web services through ActiveResource, etc.) incrementally to build a platform that Enterprise is no longer afraid to adopt.
In summary: good implementation, excellent promotion & responsiveness to the market.
Ruby has also benefitted from folks like the Pragmatic Programmers quickly legitimizing it (and Rails) with a number of books, and you have to give the folks promoting Ruby and Rails a lot of credit for trying to tackle thorny problems (e.g. migrations, web services through ActiveResource, etc.) incrementally to build a platform that Enterprise is no longer afraid to adopt.
In summary: good implementation, excellent promotion & responsiveness to the market.