Skip to content

Commit

Permalink
Added config to test helper, updated README with config info
Browse files Browse the repository at this point in the history
  • Loading branch information
krobertson committed Apr 1, 2010
1 parent 743b51f commit 195e523
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.rdoc
Expand Up @@ -41,6 +41,17 @@ In your model:
:thumb => "100x100>" }
end

You will need to add an initializer to configure Paperclip. If on Rails, can add a config/initializers/paperclip.rb, on Merb
can use config/init.rb and add it to the Merb::BootLoader.after_app_loads section. Can also use environment configs, rackup
file, Rake task, wherever.

Paperclip.configure do |config|
config.root = Rails.root # the application root to anchor relative urls (defaults to Dir.pwd)
config.env = Rails.env # server env support, defaults to ENV['RACK_ENV'] or 'development'
config.use_dm_validations = true # validate attachment sizes and such, defaults to false
config.processors_path = 'lib/pc' # relative path to look for processors, defaults to 'lib/paperclip_processors'
end

Your database will need to add four columns, avatar_file_name (varchar), avatar_content_type (varchar), and
avatar_file_size (integer), and avatar_updated_at (datetime). You can either add these manually, auto-
migrate, or use the following migration:
Expand Down
6 changes: 6 additions & 0 deletions test/helper.rb
Expand Up @@ -42,6 +42,12 @@ class Mash < Hash
end
end

Paperclip.configure do |config|
config.root = Merb.root # the application root to anchor relative urls (defaults to Dir.pwd)
config.env = Merb.env # server env support, defaults to ENV['RACK_ENV'] or 'development'
config.use_dm_validations = true # validate attachment sizes and such, defaults to false
end

def rebuild_model options = {}
Object.send(:remove_const, "Dummy") rescue nil
Object.const_set("Dummy", Class.new())
Expand Down

0 comments on commit 195e523

Please sign in to comment.