Skip to content

An input plugin for formtastic to render file fields with an image preview for paperclip attachments

License

Notifications You must be signed in to change notification settings

elandesign/formtastic_image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

An input plugin for formtastic to render file fields with an image preview for paperclip attachments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages