Hi Trond,
About the number and title fields not appearing in the form. Could you
check attr_accessible?
And about showing the file name in the edit page. Try creating
app/views/chapters/edit.dryml and adding this text:
<edit-page>
<before-form:>
<%= this.textfile_file_name %>
</before-form>
</edit-page>
Regards,
Ignacio
El 22/09/13 18:05, Trond Lossius escribió:
> Hi,
>
> In an hobo 2.0.1 application, I have two models: book and chapter, where
> chapter belongs_to book and book has_many chapters. For chapters I am
> using paperclip to upload an associated text file. This text file is set
> up as follow in the chapter model:
>
> fields do
> number :integer
> title :string
> timestamps
> end
>
> has_attached_file :textfile,
> :path =>
> "#{Rails.root}/public/media/books/chapters/:id_:basename.:extension",
> :url => "/media/books/chapters/:id_:basename.:extension"
>
> I have the basics of all of this working, but would like to do some
> modifications to the chapter form. Currently, when editing a chapter,
> the current values for /number/ and /title/ will show up, but the form
> field for textfile simply states "No file chosen". When editing an
> existing chapter record, I would rather like it to display the name of
> the currently stored textfile.
>
> I have modified the form for Chapter in
> App/views/taglibs/front_site.dryml to:
>
> <extend tag="form" for="Chapter">
> <old-form merge multipart>
> <field-list: fields="number, title, textfile"/>
> </old-form>
> </extend>
>
> Is there any way I can further customise this form so that it displays
> the name of the currently saved file (/textfile_file_name/) when editing
> an existing record?
>
> Thanks,
> Trond
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.
--
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.