Skip to content

Instantly share code, notes, and snippets.

Created December 19, 2008 20:33

Revisions

  1. @invalid-email-address Anonymous created this gist Dec 19, 2008.
    32 changes: 32 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    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 -%>