Last active
December 17, 2015 18:59
-
-
Save mxgrn/5657024 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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