Skip to content

Instantly share code, notes, and snippets.

Created December 19, 2008 20:33
Show Gist options
  • Save anonymous/38108 to your computer and use it in GitHub Desktop.
Save anonymous/38108 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
# Paperclip
@current_user.has_attached_file :photo,
:styles => {
:thumb=> "100x100#",
:small => "150x150>",
:medium => "300x300>",
:large => "400x400>" }
This is the method for where the user uploads the photo:
def photoUpload
@user = @current_user
end
And this is the view for uploading that photo:
<%= error_messages_for :photo %>
<% form_for(@user,:html => { :multipart => true }) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label 'Photo' %><br />
<%= f.file_field :photo %>
</p>
<p>
<%= submit_tag 'Upload' %>
</p>
<% end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment