Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 842 Bytes

File metadata and controls

35 lines (21 loc) · 842 Bytes

FormtasticImage

An extension for Formtastic1 to generate file inputs for paperclip2 fields.

Example

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 %>

Dependencies

You must have the formtastic gem/plugin and the paperclip gem/plugin added to your application.

Todo

Test, test, test…

References

1 Formtastic @ GitHub

2 Paperclip @ Github

Copyright © 2009 Paul Smith, released under the MIT license