Skip to content

Instantly share code, notes, and snippets.

@jimneath
Created August 9, 2010 19:20
Show Gist options
  • Save jimneath/515943 to your computer and use it in GitHub Desktop.
Save jimneath/515943 to your computer and use it in GitHub Desktop.
class NotesController < ApplicationController
def create
@note = Note.new(params[:note])
if @note.save
# attach files
params[:note][:file].to_a.each do |file|
@note.note_attachments.create(:file => file)
end
# set flash, redirect etc
else
# render form again
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment