Вопрос

I need to develop a simple File Upload I'm using padrino and slim-templates. Also generated my views using the padrino command generator such as padrino g admin_pages modelName. Now I want to add a fileUpload field to the generated code... I'm getting this error:

undefined method `name' for nil:NilClass

My question is any way to automatically generate the admin page with this functionality or simply add the field manualy?

This is the code:

= f.text_field :newName, :class => 'form-control input-large input-with-feedback',    
= f.label :content, :class => 'control-label'
= f.text_area :content, :class => 'form-control input-large input-with-feedback'
= f.file_field  :fileimg    
= f.submit pat(:save), :multipart => true ,:class => 'btn btn-primary'

Thanks in advance!

Это было полезно?

Решение

It seems that fileimg field is nil for the record f. Make sure that it isn't `nil, and in that case, it shell be validated by a model validation rule.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top