We Recommend

The Rails Way The Rails Way
Now, for the first time, there’s a comprehensive, authoritative guide to building production-quality software with Rails. Pioneering Rails developer Obie Fernandez and a team of experts illuminate the entire Rails API, along with the Ruby idioms, design approaches, libraries, and plug-ins that make Rails so valuable.


Posted By

t0d0r on 06/24/07


Tagged

textmate rails random name domain generate


Versions (?)


Generate random domain name


Published in: Rails 


  1. def domain_name
  2. [
  3. "www",
  4. ("a".."z").to_a.sort_by{rand}.join.slice(0..rand(15)),
  5. %w{com net org}[rand(3)]
  6. ].join('.').downcase
  7. end
  8.  

Report this snippet 

You need to login to post a comment.