Rails生成回形针图像错误

时间:2014-11-13 04:48:18

标签: ruby-on-rails imagemagick

运行`rails generate paperclip pin image'时收到错误。下面是代码,我还附上了一张图片。

Screenshot of Error

http://i.stack.imgur.com/bFkgX.png

Last login: Wed Nov 12 23:09:38 on ttys003
Jovans-MacBook-Pro:pinteresting jovanhernandez$ rails generate paperclip pin image
/Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/generators/actions/create_migration.rb:13:in `migration_file_name': protected method `migration_file_name' called for #<PaperclipGenerator:0x007fb290c350b0> (NoMethodError)
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/generators/actions/create_migration.rb:34:in `existing_migration'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:112:in `invoke_with_conflict_check'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in `invoke!'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/generators/migration.rb:34:in `create_migration'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/generators/migration.rb:63:in `migration_template'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/paperclip-3.5.4/lib/generators/paperclip/paperclip_generator.rb:16:in `generate_migration'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/generators.rb:157:in `invoke'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/commands/generate.rb:11:in `<top (required)>'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:135:in `generate_or_destroy'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:51:in `generate'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /Users/jovanhernandez/.rvm/gems/ruby-2.1.2/gems/railties-4.1.6/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:8:in `require'
    from bin/rails:8:in `<main>'
Jovans-MacBook-Pro:pinteresting jovanhernandez$ 

2 个答案:

答案 0 :(得分:0)

gem 'paperclip', github: 'thoughtbot/paperclip'添加到您的gemfile。

信用证转到:https://github.com/thoughtbot/paperclip/issues/1495

答案 1 :(得分:0)

我遇到了同样的问题。我有一个在我的gemfile中指定的paperclip版本,它太旧了,无法与我的其他版本一起使用。也许只需用

之类的东西更新gemfile的版本号

gem&#39; paperclip&#39;,&#39;〜&gt; 4.3&#39;

请相信你 $ bundle install 更新版本后,在你说之前 $ rails生成回形针图像