An extension for Formtastic1 to generate file inputs for paperclip2 fields.
In the model class:
class User < ActiveRecord::Base
has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
end
And in the view
<% semantic_form_for @user do |form| %>
<% form.inputs do %>
<%= form.input :avatar, :as => :image, :preview_size => :thumb %>
<% end %>
<% end %>
You must have the formtastic gem/plugin and the paperclip gem/plugin added to your application.
Test, test, test…
Copyright © 2009 Paul Smith, released under the MIT license