Problems in Rails

Problem: Issue with rails missing the rake gem
Solution: Install rake to the rvm global environment

rvm ruby-2.0.0-p###
gem install rake -v 10.1.0


Problem: It looks like Bundler could not find a gem. This is probably because your application is being run under a different environment than it's supposed to.
Solution: Manage gems with rvm. In my case, 'passenger' was using the global gemset even though I specified the project to use env1... solution is of course to install all missing gems for the global gemset.

# list the gemsets
rvm gemset list
# to use env1 gemset
rvm 2.0.0-p###@env1
# to use global gemset
rvm 2.0.0-p###@global
# install missing gems
gem install
bundle install


Problem: Various commands for cloning/creating/deleting gemsets
Solution: Use rvm

# clone
rvm gemset copy 2.0.0-pXXX@env1 2.0.0-pXXX@env2
# create
rvm gemset create env2
# delete
rvm gemset delete env2


Problem: When POW complains that rake does not exist
Solution: Add a .powrc file with the following content:

if [ -f "$rvm_path/scripts/rvm" ]; then
  source "$rvm_path/scripts/rvm"

fi
rvm ruby-2.0.0-pXXX@env1


Problem: Gem::LoadError: You have already activated json 1.8.1, but your Gemfile requires json 1.8.0 ...
Solution-1: Globally, call bundle uninstall json -v 1.8.1
Solution-2: Locally, call bundle update json






No comments: