Deploying rails, paperclip error, no such file to load -- cocaine - ruby-on-rails

Using the paperclip-cloudfiles fork of paperclip:
gem 'paperclip-cloudfiles', '~>2.3', :require => 'paperclip'
Using passenger and I get the following load error: no such file to load -- cocaine
Key part of stack trace:
.rvm/gems/ruby-1.9.2-p180/gems/paperclip-cloudfiles-2.3.10.1/lib/paperclip.rb 43 in `'
Paperclip works fine locally on the development server. Haven't been able to find any reference to this problem. Any ideas?

I would add
gem require 'cocaine'
to your Gemfile then run bundle install again.
Extra credit . . . add the dependency to the gem itself and send it back to the community at large.
Updated: per this issue, you should specify version 0.3.2 of cocaine or Paperclip will break. Paperclip currently relies on an older Cocaine API, so specifying the version (0.3.2) in the gemfile in necessary or paperclip won't work.
gem "cocaine", "0.3.2"

[SOLVED]: Downgraded paperclip-cloudfiles to '2.3.8' and it works. Must be a problem with the current version.

Have you already run bundle install on your production server?

You can simply install the missing cocaine gem by
'gem install cocaine'
and everything works.

This might be related to this issue. Paperclip currently relies on an older Cocaine API, so specifying the version (0.3.2) in the gemfile in necessary or paperclip won't work.

Related

Rails 6.1.5: uninitialized constant Mail::TestMailer

Why am i getting 'uninitialized constant Mail::TestMailer' error with "Rails 6.1.5 & Ruby 3.1.0" while working without problems "Rails 6.1.5 & Ruby 3.0.1" ?
Found following from NEWS for Ruby 3.1.0.
The following default gems are now bundled gems.
net-ftp 0.1.3
net-imap 0.2.2
net-pop 0.1.1
net-smtp 0.3.1
matrix 0.4.2
prime 0.1.2
debug 1.4.0
So, i just added next 3 lines into GemFile. It worked fine.
gem 'net-smtp' # to send email
gem 'net-imap' # for rspec
gem 'net-pop' # for rspec
I had similar issue, after debugging and troubleshooting. I made changes to the Rails version to 6.1.1.4 instead of 6.1.7. The I got similar error stating that it could not load some .rb files from the mail gem.
What I did was to give them the read perssion to others.
chmod 644 .rb
and the application loaded fine after that.
I was getting same issue after deploying the code on server.
Version details-
Rails 6.1.5
ruby 3.1.2p20
I just install a new gem as-
gem 'net-smtp'
and issue got resolved.

Upgrading to Rails 4.2 issues

I'm trying to upgrade to Rails 4.2 from Rails 4.1.9 and when I attempt to run the console or the server i get the following error. Any thoughts? I thought the html-scanner gem was included with Action::View
gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- action_view/vendor/html-scanner (LoadError)
The OP's issue (and mine) was to do with an incompatibility in the prototype-rails gem. This can be fixed by using the "4.2" branch of prototype-rails directly from github. Modify your Gemfile entry as follows:
gem 'prototype-rails', github: 'rails/prototype-rails', branch: '4.2'
Note that the prototype-rails gem will not be supported from Rails 5 onwards, so now would be as good a time as any to remove this dependency.
I believe they removed html-scanner from rails in 4.2 when they switched to rails-html-sanitizer according to the upgrade guide but it seems you can use the rails-deprecated_sanitizer gem to your Gemfile to then re-include the html-scanner library
gem 'rails-deprecated_sanitizer'
Hope this helps!
I've also had this problem on a legacy project. It's a bundler 1.17.3 / ruby 2.4 / rails 4.2.11.3 and it was driving me up the wall.
The following nasty hack worked:
Gemfile:
gem 'rails-deprecated_sanitizer'
gem 'prototype-rails', git: 'https://github.com/rails/prototype-rails.git', branch: '4.2'
but that wasn't enough. I then had to get rails-deprecated_sanitizer to appear where the gems wanted it.
So in my project, I created lib/action_view/vendor/html-scanner.rb:
require 'rails-deprecated_sanitizer'
require 'rails/deprecated_sanitizer/railtie'
require 'rails/deprecated_sanitizer/html-scanner'
(I doubt all three are needed, mind)
This depends on lib being in your load paths of course.
That fixed the problem, and I was finally able to reset the db and launch the server.

Ruby - Install Sinatra gem error on ruby mine

I'm working on a new project in Ruby, which I'm learning, and I need to install Sinatra gem and I'm getting the following error:
"Following gems were not installed: sinatra-sinatra (0.10.1): While
executing gem ... (Gem::UnsatisfiableDependencyError)
Unable to resolve dependency: 'sinatra-sinatra (= 0.10.1)' requires 'rack (>= 1.0)'"
Currently I'm using, RubyMine (Windows). Any help would be appreciated.
Thanks
The problem is not RubyMine, but some other dependency conflict in your app. The gem sinatra-sinatra requires Rack 1.0, there is probably another gem in your Gemfile that requires a greater or different version of the same gem.
Actually, I believe your problem can easily be fixed by using the proper gem. sinatra-sinatra is a very old gem, if you want to use the Sinatra framework the correct gem is sinatra. Update your Gemfile accordingly.
In you machine
gem install sinatra-sinatra
Check you Gemfile
gem 'sinatra-sinatra', '~> 0.10.1'
Delete the Gemfile.lock and bundle its once again.

Rails 4 full page caching is not working

Rails4 full page caching is removed and extracted as gem and I am using that gem called 'actionpack-page_caching', but it is not working. It is throwing undefined method `caches_page' for controller class. I tried a lot to debug the issue but no relevant documentation for the same. Please help me out with the solutions.
Even though your bundle command says you have those 2 gems installed
gem 'actionpack-page_caching'
gem 'actionpack-action_caching'
Try to delete the Gemfile.lock file and run the bundlecommand again.
And my output on the second run was correct:
Installing actionpack-action_caching (1.1.0)
Installing actionpack-page_caching (1.0.2)
And I was able to use caches_page.

Rails 3.0.3, rails_admin gem, generator not found

I am getting error installing Rails_admin with rails 3.0.3. Command line log shown below -
C:\rorprj\app>gem uninstall rails_admin
Successfully uninstalled rails_admin-0.0.0
C:\rorprj\app>gem install rails_admin
Temporarily enhancing PATH to include DevKit...
Successfully installed rails_admin-0.0.0 1 gem installed
Installing ri documentation for rails_admin-0.0.0...
Installing RDoc documentation for rails_admin-0.0.0...
C:\rorprj\app>rails generate rails_admin:install_admin
**Could not find generator rails_admin:install_admin.**
C:\rorprj\app>rails -v
Rails 3.0.3
Anything I can do fix this?
Try this
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
Sometimes the actual github repo has an different version. I have it running on 3.0.3 and that is what is in my gemfile.
If you call
rails generate rails_admin
the 'help' returns
*Hello, to install rails_admin into your app you need to ru*n:
rake rails_admin:install
And this works. I just encountered the same problem as you. (Keep in mind that you need to add the gem to the gemfile too)
Did you add this gem to your Gemfile? This file is responsible for loading all gems that your application depends on, and if this gem isn't specified in it then it will not be loaded.

Resources