Displaying a Carrierwave filename in the view

前端 未结 10 1113
暖寄归人
暖寄归人 2020-12-13 23:29

I am trying to display the filename of a Carrierwave attachment in a Rails erb template. The following does not work:

<%= @page.form.filename %>
         


        
10条回答
  •  南方客
    南方客 (楼主)
    2020-12-13 23:46

    You're right @epylinkn. Documentation points towards using:

    @page.form.file.identifier
    

    But when I use that, I always get nil (just as @Cheng commented).

    I then inspected my objects methods (@page.form.file.methods.inspect), and found the following to work:

    @page.form.file_identifier
    

提交回复
热议问题