Paperclip: How to store a picture in a Rails console?
To further clarify @andrea's answer:
YourPaperclippedModelHere.new(:your_paperclip_field => File.new(path, "r"))
So if your model is called Image and your paperclip field is data:
Image.new(:data => File.new(path_to_your_file, "r"))
If this is the model:
class User < ActiveRecord::Base has_attached_file :avatarend
then the following should work from the console:
>> User.create(:avatar => File.open('/path/to/image.jpg', 'rb'))
I dont know if it is what you want ... butto save an paperclip asset from consoleYou could simple use a File instance .a.e.
Image.new :data=>File.new("/path/to/image.jpg","r")