I'm new in Ruby/Rails, so, my question: what is the perfect way to upload file and save filename in database with rails? Are there any Gem? Or maybe there are good build-in feature?

有帮助吗?

解决方案

You can try Paperclip.It is most popular gem in rails community...

   https://github.com/thoughtbot/paperclip

these lines do the all stuff

   class User < ActiveRecord::Base
     has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
   end

Try it......

其他提示

Also try carrierwave, Ryan has a good screencast about this gem

Most people use the Paperclip Gem.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top