Paperclip on Rails 3 Beta
by James
Update: you should read this more recent article for an explanation of how to use Paperclip with the latest beta release of Rails 3.
I got Paperclip working on Rails 3 today. Here’s how.
First, I found (by accident) a branch in the Paperclip repository on Github called “Rails 3″. Call me crazy but I thought that might be worth a try.
Normally you’d install Rails 3 plugins using rails plugin install, but in this case I used git submodule:
These two commands checkout the rails3 branch of Paperclip into vendor/plugins/paperclip, as a Git submodule. If you don’t understand Git submodules, you can read about them here.
I also found that Paperclip wasn’t properly handling image styles; the ‘Paperclip’ section of this post explains how I fixed this (a word of warning: it’s a simple one-line edit which solved my problem but is untested with regard to the rest of Paperclip).
As always, feel free to post questions or feedback in the comments. Good luck!
If you prefer a gem based installation of paperclip, you might prefer using the following line in your Gemfile:
gem ‘paperclip’, :git => ‘git://github.com/thoughtbot/paperclip.git’, :branch => ‘rails3′
Update your gems with a simple
bundle install
And you should be set.
Nice one Joseph :) The Gemfile is ace.
[...] 此处参考:http://jameswilding.net/2010/02/07/paperclip-on-rails-3-beta/ [...]