尝试在我的主页横幅中为我的rails应用程序创建图像
我已经设置了Dropbox API并将其连接到我的rails应用程序,当我运行它时它可以工作在本地主机上。图像显示正确。但是当我运行它时它符合正确要求,但是当我打开时,我收到应用程序错误
希罗库日志
2014-04-05T10:07:27.320325+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-04-05T10:07:27.320325+00:00 app[web.1]: Exiting
2014-04-05T10:07:27.321149+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require': /app/app/models/post.rb:8: syntax error, unexpected =>, expecting keyword_end (SyntaxError)
2014-04-05T10:07:27.321149+00:00 app[web.1]: :storage => :dropbox,
2014-04-05T10:07:27.321149+00:00 app[web.1]: ^
2014-04-05T10:07:27.321149+00:00 app[web.1]: /app/app/models/post.rb:9: syntax error, unexpected ',', expecting keyword_end
2014-04-05T10:07:27.321149+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `block in require'
2014-04-05T10:07:27.321149+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:214:in `load_dependency'
2014-04-05T10:07:27.321149+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require'
2014-04-05T10:07:27.321149+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:330:in `require_or_load'
2014-04-05T10:07:27.321149+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:289:in `depend_on'
2014-04-05T10:07:27.321149+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:207:in `require_dependency'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:464:in `each'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:464:in `block in eager_load!'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:462:in `each'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:462:in `eager_load!'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:347:in `eager_load!'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/application/finisher.rb:56:in `each'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:30:in `instance_exec'
2014-04-05T10:07:27.321363+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:30:in `run'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:55:in `block in run_initializers'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/initializable.rb:54:in `run_initializers'
2014-04-05T10:07:27.321544+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/application.rb:215:in `initialize!'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/railtie/configurable.rb:30:in `method_missing'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `block in require'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:214:in `load_dependency'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/config.ru:3:in `block in <main>'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
2014-04-05T10:07:27.322203+00:00 app[web.1]: from /app/config.ru:in `new'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/config.ru:in `<main>'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands/server.rb:48:in `app'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands/server.rb:75:in `start'
2014-04-05T10:07:27.322418+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:76:in `block in <top (required)>'
2014-04-05T10:07:27.322824+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `tap'
2014-04-05T10:07:27.322824+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/commands.rb:71:in `<top (required)>'
2014-04-05T10:07:27.322824+00:00 app[web.1]: from bin/rails:4:in `require'
2014-04-05T10:07:27.322824+00:00 app[web.1]: from bin/rails:4:in `<main>'
2014-04-05T10:07:28.741283+00:00 heroku[web.1]: Process exited with status 1
2014-04-05T10:07:28.751166+00:00 heroku[web.1]: State changed from starting to crashed
后.rb
class Post < ActiveRecord::Base
validates :company, :contact, :email, :telephone, :website, presence: true
belongs_to :posts
:storage => :dropbox,
:dropbox_credentials => Rails.root.join("config/dropbox.yml"),
end
在此文件中获取语法错误,因此删除了逗号,但仍会收到相同的错误
您是否尝试过使用 Paperclip
的 has_attached_file
属性(如 paperclip-dropbox
gem 文档中所述):
#app/models/post.rb
Class Post < ActiveRecord::Base
has_attached_file :avatar,
:storage => :dropbox,
:dropbox_credentials => Rails.root.join("config/dropbox.yml")
end