Skip to content

Instantly share code, notes, and snippets.

@mxgrn
Last active December 17, 2015 18:59
Show Gist options
  • Save mxgrn/5657024 to your computer and use it in GitHub Desktop.
Save mxgrn/5657024 to your computer and use it in GitHub Desktop.
class BookFormWithFileUpload < Netzke::Basepack::Form
def configure(c)
super
c.model = "Book"
end
def items
[{name: 'cover', xtype: :filefield}, *super]
end
endpoint :netzke_submit do |params, this|
super params, this
# +record+ will contain updated record along with the attachment
end
end
## MODEL
class Book < ActiveRecord::Base
attr_accessible :cover
mount_uploader :cover
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment