【问题标题】:Difficulty in getting mp3 to work in Paperclip很难让 mp3 在 Paperclip 中工作
【发布时间】:2011-07-28 11:31:04
【问题描述】:

我正在尝试让 Paperclip 接受 mp3 文件。我能够让它在 Rails 2 应用程序中工作,但在 Rails 3 中遇到困难。我可以让文件显示在我的资产目录中,但我继续列出 missing.png 而不是适当的文件在表演动作中。

这是我的模型代码...

has_attached_file :讲道文件, :url => "/assets/:class/:id/:style/:basename.:extension", :path => ":rails_root/public/assets/:class/:style/:id/:basename.:extension" attr_accessor :sermonfile_file_name attr_accessor :sermonfile_content_type
attr_accessor :sermonfile_file_size
attr_accessor :sermonfile_updated_at

这是表单视图...

{:multipart => true} 做 |f| %>

禁止这个布道 从被保存:

  <ul>
  <% @sermon.errors.full_messages.each do

|消息| %>









  • "mceEditor" %>

  • 这是我用来在显示视图中呈现文件的内容...

    非常感谢任何帮助!

    【问题讨论】:

    • 你能正确格式化吗?特别是粗体部分

    标签: ruby-on-rails paperclip


    【解决方案1】:

    您的 :url:path 将它们的 :id:style 混淆了。它们应该是相同的::id/:style

    has_attached_file :sermonfile, 
      :url => "/assets/:class/:id/:style/:basename.:extension", 
      :path => ":rails_root/public/assets/:class/:id/:style/:basename.:extension" 
    

    【讨论】:

      猜你喜欢
      • 2013-04-28
      • 2017-08-18
      • 2016-02-19
      • 2020-05-20
      • 1970-01-01
      • 2012-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多