need help: bundler / gems > method missing

hi,

im trying to deploy an app via cap3/bundler/rvm on debian , user-rvm

i go the app-code on the server, but when i test it via:

bundle exec rails s -b 0.0.0.0 -p 3000 -e staging

it throws an error that a method is missing.

gem list shows all gems , i have tried to install gems via bundle install ( --system & path vendor/plugins)

where is my problem??? what should i do?

thx for any pointers

ps the app runs just fine locally

You have to check the scope of the gems you are using, since you are using bundle exec, bundler will only load the gems you have not specified in the given environment, in this case staging, so if you have something like this

group :test, :development, :staging do

gems in that group only load in the specific environment, so if you have a something like this

group :test, :development do

gem ‘foo’

Foo will not load in staging environment.

Another thing is that is you are using capistrano/bundler, gems are not in stalled in the system or $GEMHOME, they are in shared/bundle/ruby/RUBY_VERSION/gems, so they might not show up when you do gems list outside the current folder. Pay attention to your capistrano recipe.rb so check how you are loading the application.

Please provide more details about your Gemfile, and your capistrano recipe.rb to be able to help you more.

Hi Radhames,

running webrick (3000) on the server is fine, app loads.

doing bundle show rails gives:

/home/railsuser/.rvm/gems/ruby-2.3.1@my_gemset/gems/rails-4.1.6

but when i run nginx with staging or production gives me the same error (method not found aka ( i guess) gems not loaded)

so question is how do i tell rvm // bundler / passenger where my gems are?

ps: gem file

i took all the stages out and listed the gems only

recipe:

require ‘capistrano/rvm’

require “whenever/capistrano”

#require “bundler/capistrano”

#require “rvm/capistrano” # Load RVM’s capistrano plugin. OLD

set :stages, [“staging”, “production”]

set :default_stage, “staging”

set :rbenv_ruby, ‘2.2.4’

set :rvm_type, :user #system #; user ; system = rvm system wide install

set :application, ‘appname’

set :bundle_binstubs, nil

set :scm, :git

set :repo_url, “railsuser@SOMEIP:/gitrepos/my_repo.git”

set :ssh_options, {:forward_agent => true}

set :keep_releases, 5

set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

SSHKit.config.command_map[:rake] = “bundle exec rake” #8

SSHKit.config.command_map[:rails] = “bundle exec rails”

set :pty, true

set :format, :pretty

set :tmp_dir, “/home/username/tmp”

#set the user on our server that we want Capistrano to run commands with:

set :user, “username”

thx

Are you sure it is that? What is the exact error message?

Colin

uncomment capistrano/bundler, with passenger if you have it correctly configure, passenger will use ‘bundle exec rails s passenger’ from within the ‘current’ folder of the app, just remember that the bundler gem has to be accesible from anywhere in the system when you do gem list.