Walter Davis wrote in post #1065538:

>   match '/:slug', :to => 'uploaded_files#show'
>
> That should do the trick.
>
> Here's a way to make a very terse code for your URL:
>
>   def set_slug
>     code = Array.new(7) { (('A'..'Z').to_a + (0..9).to_a)[rand(36)]
> }.join.to_s
>     if UploadedFile.find_by_slug(code)
>       return self.set_slug()
>     else
>       self.slug = code
>     end
>   end
>
> Call it in an after_create.
>
> Walter

Thanks a lot. It is working :) cheers....

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to