Skip to content

Instantly share code, notes, and snippets.

@croaky
Created August 10, 2008 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save croaky/4768 to your computer and use it in GitHub Desktop.
Save croaky/4768 to your computer and use it in GitHub Desktop.
def create
@photo = Photo.new :image => params[:Filedata]
@photo.save
render :partial => '/photos/show', :locals => { :photo => @photo }
end
class Photo < ActiveRecord::Base
has_attached_file :image,
:styles => { :medium => "500", :small => "150x150#" },
:path => ":rails_root/public/assets/images/:id/:style.:extension",
:url => "/assets/images/:id/:style.:extension"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment