Created
December 19, 2008 20:33
-
-
Save anonymous/38108 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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