未定义的方法`include?&#39;对于#<pathname:public =“”system =“”:attachment =“”:style =“”:filename =“”>

时间:2017-07-12 08:25:15

标签: ruby-on-rails paperclip ruby-on-rails-5

我想将rails应用程序升级到rails 5.1和ruby 2.4.0

我想要删除时出现此错误 (未定义的方法`include?&#39; for#)

这是我在graphic_creation_file_controller中的动作

def delete
@graphic_creation_file = GraphicCreationFile.find(params[:id])
gc_id = @graphic_creation_file.graphic_creation_id
if @graphic_creation_file.destroy
  flash[:notice] = 'Data was successfully deleted.'
  redirect_to :controller => :graphic_creation_file, :action => :list, :graphic_creation_id => gc_id
else
  flash[:error] = 'Data was NOT successfully deleted.'
  redirect_to :controller => :graphic_creation_file, :action => :list, :graphic_creation_id => gc_id
end
end

这是我的观点

   <%= link_to "New Comment", {:controller => :comment, :action => :new, :graphic_creation_file_id => file},{ :class=>"btn btn-success" , :role=>"button" } %>
      <div style="margin: 2px 0;"></div>
      <%= link_to "Edit", {:controller => :graphic_creation_file, :action => :edit, :id => file},{ :class=>"btn btn-primary" , :role=>"button" } %>
      <div style="margin: 2px 0;"></div>
      <%= link_to "Delete", {:controller => :graphic_creation_file, :action => :delete, :id => file},{:confirm => 'Are you sure?', :class=>"btn btn-danger" , :role=>"button" } %>
    </td>
  </tr>

应用程序将paperclip gem用于我要删除的文件

这是我的模型graghic_creation_file.rb

has_attached_file :eps,:path => Rails.root.join('/public/system/:attachment/:style/:filename')
validates_attachment_content_type :eps, content_type: ['image/x-eps' ]  
has_attached_file :png, :styles => { :medium => '600x800>', :thumb => '150x200>' }

为什么这((未定义的方法`包括?&#39;))thnx

0 个答案:

没有答案