Skip to content

Instantly share code, notes, and snippets.

@tliff
Created March 15, 2010 14:34
Show Gist options
  • Save tliff/332882 to your computer and use it in GitHub Desktop.
Save tliff/332882 to your computer and use it in GitHub Desktop.
class User
has_many :entries
end
class Entry
has_many :images
belongs_to :user
end
class Image
has_attached_image :image
belongs_to :entry
end
##########################
def upload
@entry = Entry.find(…)
@image = @entry.images.new(params[:…])
@image.save
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment