Sha256: 0c7e696249c2ec5df7ddb6a28234d91ac286a1d63e6122c18f3ea643fe9178e5
Contents?: true
Size: 892 Bytes
Versions: 5
Compression:
Stored size: 892 Bytes
Contents
# -*- encoding : utf-8 -*- InlineForms::SPECIAL_COLUMN_TYPES[:simple_file_field]=:string def simple_file_field_show(object, attribute) o = object.send(attribute) method = attribute_values(object, attribute)[0][1] if o.send(:present?) filename = o.to_s model = object.class.to_s.pluralize.underscore link_to filename, "/#{model}/#{method}/#{object.id}" # route must exist!! else link_to_inline_edit object, attribute, "<i class='fi-plus'></i>".html_safe end end def simple_file_field_edit(object, attribute) file_field_tag attribute, :class => 'input_text_field' end def simple_file_field_update(object, attribute) object.send(attribute.to_s + '=', params[attribute.to_sym]) end # You need to add a route to your routes.rb file: # get '/:model/dl/:id' => 'your_controller#download', :as => 'download' # and a method to your controller: # def download # FIXME
Version data entries
5 entries across 5 versions & 1 rubygems