[英]How to use the attach gem in rails 5
My environment: 我的环境:
I am trying to use the attach gem, written by the person who also wrote this article https://atech.blog/atech/file-attachments-in-rails-tutorial . 我正在尝试使用由也写这篇文章的人https://atech.blog/atech/file-attachments-in-rails-tutorial编写的人编写的attach gem。
When I run the bundle install it installs attach gem, version 1.0.2 运行捆绑安装程序时,它将安装版本1.0.2的附加gem。
Then when I try to run the rake command I get an error saying it does not know how to build the task. 然后,当我尝试运行rake命令时,出现一条错误消息,提示它不知道如何构建任务。
rake attach:install:migrations --trace
rake aborted!
Don't know how to build task 'attach:install:migrations' (see --tasks)
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/task_manager.rb:59:in `[]'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:159:in `invoke_task'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:116:in `each'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:116:in `block in top_level'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:125:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:110:in `top_level'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:83:in `block in run'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:80:in `run'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.4.1/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.4.1/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
Any ideas on what the error is? 关于错误的任何想法? I am wondering if I am missing a required gem to make it work.
我想知道我是否缺少使它工作所需的宝石。 The link to the attach documentation is https://github.com/adamcooke/attach
附件文档的链接是https://github.com/adamcooke/attach
There are no rake tasks defined in this repo. 此仓库中未定义任何rake任务。
After you run bundle install
, you can get a list of rake tasks by running rake -P
( rake -T
shows tasks with descriptions). 运行
bundle install
,可以通过运行rake -P
获得rake任务的列表( rake -T
显示具有描述的任务)。 You'll see that attach:install:migrations
is not there. 您会看到
attach:install:migrations
不存在。
Why not try using paperclip
? 为什么不尝试使用
paperclip
呢?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.