NoMethodError:未定义的方法`has_attached_file' [英] NoMethodError: undefined method `has_attached_file'

查看:52
本文介绍了NoMethodError:未定义的方法`has_attached_file'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Paperclip 在检查插件的 rails3 分支后产生此错误.我的 Gemfile 有以下几行:

Paperclip produces this error, after checking out the plugin's rails3 branch. My Gemfile has following line:

gem 'paperclip', :git => 'http://github.com/thoughtbot/paperclip.git', :branch => 'rails3'

错误信息是:

NoMethodError: undefined method `has_attached_file' for #<Class:0x2a50530>

推荐答案

更新 06-21-10: thoughtbot 版本已修复.

我必须在 class Application < 的末尾将 Paperclip::Railtie.insert 添加到我的 application.rb 中.Rails::Application 使其正常工作.由于官方回购正在运行,我已经删除了我的分叉.希望对某人有所帮助.

I had to add Paperclip::Railtie.insert to my application.rb at the end of class Application < Rails::Application to get it to work correctly. I have deleted my fork since the official repo is working. Hope that helps someone.

您还需要将以下内容添加到您的 Gemfile 中

You will also need to add the following to your Gemfile

gem "paperclip", :git => "http://github.com/thoughtbot/paperclip.git"

这篇关于NoMethodError:未定义的方法`has_attached_file'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆