document management in ROR


I want to work on a document management system for my ROR project.

1. Does any one know of an existing DMS platform / plugin / gem which
I can build upon for my DMS within my application?
2. If not, does anyone know the rails code to upload document from
local folder of web client to server. Something like the old
attachments of GMAIL?