Cannot load such file zip/zip when running rake test:prepare - ruby-on-rails-4

When trying to prepare my database, I keep getting a Cannot load such file: zip/zip error. I have seen this problem on SO but none of the answers worked for me. Does anyone have any ideas?
I'm using Ruby 2.0.0-p247 and Rails 4.0.1

You can add gem 'zip' to your Gemfile to solve this problem

Related

Unable to access rails console

I have deployed my application onto openshift and everything is working great until I tried to access the rails console.
ssh openshiftsshlogin
cd ~/app-root/repo/
rails c
When I run the above command I get this error.
bash: rails: command not found
My web application is open source which may help to diagnose the error.
Link to the Github repository.
Also when I run...
bundle exec rails c
I get the following error,
bundler: command not found: rails
Install missing gem executables with `bundle install`
/usr/lib/ruby/gems/1.8/gems/bundler-1.5.2/lib/bundler/friendly_errors.rb:10:in `with_friendly_errors': uninitialized constant Thor::AmbiguousTaskError (NameError)
from /usr/lib/ruby/gems/1.8/gems/bundler-1.5.2/bin/bundle:20
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
I dont belive i need to manually install the rails gem as the gear is running a rails application just fine.
try RAILS_ENV=production bundle exec rails console
So weirdly enough I solved the issue by just running "gem install rails" even though I should not of needed to. So if a future person runs into this issue just run...
gem install rails
RAILS_ENV=production bundle exec rails console
That should solve the issue.

rails tutorial could not locate gem file when bundle install

Hi I'm new to Ruby on rails and doing the tutorial on railstutorial.org, I'm stuck on the the first chapter about bundler install.I updated my gem file to what version I want them on but when I go to hello_app directory and type bundle install in in my shell I get a "couldn't find gem file". I type LS or ls in the hello_app directory and gemfile.rb shows up. what am i doing wrong? Ive done a search on this topic for 2 hours I have not found a solution. I have rails 4.2.1 installed but i also installed 4.2.0 because the book calls for this version, don't know if thats the cause.
If you installed rails correctly before creating a new rails app, I'm not sure you'll even need to update your gems with the bundle install
I found out what was wrong. I had saved the Gemfile in a .rb extension thinking it was suppose to be a ruby file. thats why it couldn't find the Gemfile. how I found out was just restarting the rails project from the beginning and do it step by step. I found the original Gemfile didn't have the .rb file extension, so when I tried bundle install it worked. thank for the reply #Mba Uchenna.

Rails Error in Terminal

My code was working fine yesterday and then after I reverted some changes from git I am getting this error
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.8.3/lib/bundler/runtime.rb:34:in `block in setup': You have already activated spring 1.3.4, but your Gemfile requires spring 1.3.3. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
I am unsure how to fix this I have ran the bundle command in terminal with still no luck! Please HELP MEEEE!!!!
I found the answer here for anyone looking to solve the same or similar issue:Couldn't run migration after spring update in Rails
You need to run bundle update spring in terminal

PG pg_ext load error in rails

I recently updated to rails 4.1.6 and ruby 2.1.3p242. I also updated all gems on my system. After creating a new app, I keep getting a pg_ext load file error on running the server. I'm on windows 8 x64 with PostgreSQL 9.3. The pg gem was working fine under my previous RoR installation which was rails 3.2 and ruby 1.9.3.
Under the gem's installation directory, I've a 2.0/pg_ext.so file. I tried renaming the folder to 2.1 and ran the server. The result was the same. I assume it's cause Ruby doesn't allow to Require a .so file. Below is the screenshot of the error:
Any help would be really appreciated. Thanks!
Posted question on the official Gem page:
https://bitbucket.org/ged/ruby-pg/issue/192/pg_ext-load-error
As per the suggestion, I installed the pre-version of the next release. That gave me another error which was solved using:
https://github.com/tzinfo/tzinfo/wiki/Resolving-TZInfo::DataSourceNotFound-Errors
TZInfo::DataSourceNotFound error starting Rails v4.1.0 server on Windows
Posting the answer to help people facing similar problems in the future.
1) In the command line enter:
gem install pg --pre
gem list pg
2) In the Gemfile set the gem to the newly installed version:
gem 'pg', '~> 0.18.2'

Could not find i18n-0.6.4 in any of the sources (Bundler::GemNotFound)

Opened up a Rails project I haven't coded in a while and I just tried starting up the Rails server with:
`rails s`
and I get this error message:
.rvm/gems/ruby-2.0.0-p195#global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find i18n-0.6.4 in any of the sources (Bundler::GemNotFound)
Fwiw, I've done a bundle install and here's what I get when I check i18n:
$ gem list i18n
*** LOCAL GEMS ***
i18n (0.6.5)
Any idea what the problem is and how it should be fixed?
In case your rails gem is in the Gemfile, you should run
bundle exec rails s
instead. HTH.
There may be an issue with how you installed RVM.
Try calling gem list and see if it's mentioned anywhere there.
There's a Rails guide to internationalization API. It may contain useful information if reintalling RVM doesn't fix anything
http://guides.rubyonrails.org/i18n.html