2
votes

The standard method for setting paperclip image data:

In your edit and new views:

<% form_for :user, @user, :url => user_path, :html => { :multipart => true } do |form| %> <%= form.file_field :avatar %> <% end %> In your controller:

def create @user = User.create( params[:user] ) end

However I have a whole dir of files on s3 that I want to make Image models for. How can I do this?

1

1 Answers

4
votes

Turned out to be pretty easy:

    i = Image.new
    i.image = open('/path') #requires open-uri
    i.save

(Image is my model, and image is the attachment attribute)