Need help getting rails server to work - server

So I feel incredibly frustrated. I am doing www.railstutorial.org and they require a very specific version of rails (4.2.2). I have installed it as they wanted. Put in their Gemfile specs on their "hello_app" app they provided. When I run "rails server" I get an error message saying that "byebug" is erroring. I try to install earlier and later versions of bye bug and I get the same error message. Can someone please help me? I feel pretty lost.
The tutorial is at the url below.
https://www.railstutorial.org/book/beginning#code-hello_action
alopex#alopex-TH55-HD:~/workspace/hello_app$ more Gemfile
source 'https://rubygems.org
gem 'rails', '4.2.2'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
alopex#alopex-TH55-HD:~/workspace/hello_app$ bundle install
Gem::InstallError: byebug requires Ruby version >= 2.0.0.
An error occurred while installing byebug (3.4.0), and Bundler cannot continue.
Make sure that `gem install byebug -v '3.4.0'` succeeds before bundling.
alopex#alopex-TH55-HD:~/workspace/hello_app$ sudo gem install byebug -v 3.4.0
ERROR: Error installing byebug:
byebug requires Ruby version >= 2.0.0.

I fixed this problem in this way:
Open your application's Gemfile
remove: gem 'byebug'
replace it with: gem 'pry-byebug', platform: [:ruby_20]

It isn't rails issue: byebug requires Ruby version to be 2.0 at least. You can check your Ruby version with ruby -v, I guess it is 1.9.3 in your case. You can use rvm to install actual Ruby version on your system.
Also, you can try to remove byebug from Gemfile and try to run bundle again. Maybe other gems can run with ruby 1.9.3, and you can learn rails without dealing with rvm.

Related

installing dmsf plugin in redmine

while installing dmsf plugins, I ran the following command:
bundle exec rake redmine:plugins:migrate RAILS_ENV="production"
Its throwing the following error:
rake aborted!
cannot load such file -- dav4rack
Is it due to my wrong setting of the gem file or something else? Can someone give me a clue?
Its problem for nokogiri gem version not support You have to upgrade nokogiri gem or downgrade mention in the gem file

How map mongodb on ruby and rails

I am practice on ruby on rails 4 and using mongodb database,I am trying to work follow this site to connect database : http://mongoid.org/en/mongoid/docs/documents.html
However, when I worked this step this occur error:
rails g mongoid:config
error:
Bundler could not find compatible versions for gem "activemodel":
In snapshot (Gemfile.lock):
activemodel (4.1.1)
In Gemfile:
mongoid (~> 3.1.6) x86-mingw32 depends on
activemodel (~> 3.2) x86-mingw32
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
I am also try the command bundel update but it has that error:
sorry I am new bie on ruby and rails and mongodb, so I hope there is any easy guide to follow.
thankyou
Try skipping ActiveRecord when creating your app.
rails new my_app -O
I had this problem using the following:
gem 'rails', '4.1.1'
gem 'mongoid', '~> 4.0.0'
Skipping ActiveRecord solved that error.

SystemStackError (stack level too deep): error while uploading image in rails

I am working on ROR and providing api to IOS app. In this app an IOS user uploads an image to Rails App. I am working with paperclip gem. This was working fine before I run the bundle update command. Now I am getting this error:
SystemStackError (stack level too deep):
actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:70
My Gemfile looks like this:
gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'paperclip', '~> 3.0'
gem 'activerecord-import', '>= 0.2.0'
gem 'execjs'
gem 'therubyracer'
IOS developers are using Base64 to encode an image before uploading to Rails App. My Rails app uses this method to decode the photo_data:
def decode_photo_data
data = StringIO.new(Base64.decode64(self.photo_data))
self.photo = data
end
This was all working fine but I don’t know whether it is IOS bug or Rails bug. If it is Rails bug is it related to paperclip or something else. Please help.
Ok I got the solution for this. I find out that this is a paperclip bug. Since I run the bundle update command, it downloaded a new paperclip version paperclip-3.4.1 but before bundle update or bundle install it was using paperclip-3.3.1 so now I updated my Gemfile to this:
gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'paperclip', '~> 3.3.1'
And it starts working again in my case. No error now.

Why is bundler not able to install rake even though rake appears to be present?

I'm having some trouble with rbenv and bundler. When I bundle install on my app, I get an error saying that an error occurred while installing Rake.
I'm thinking this has something to do with rbenv not pointing to the write path for gems -- but I'm not positive.
Why is bundler not able to install rake when rake appears to be present?
Console Output
deploy#telemed-test:/u/apps/telemed_solutions/current$ bundle install
Fetching gem metadata from http://rubygems.org/.......
Fetching gem metadata from http://rubygems.org/..
NoMethodError: private method `open' called for Gem::Package:Class
An error occured while installing rake (0.9.2), and Bundler cannot continue.
Make sure that `gem install rake -v '0.9.2'` succeeds before bundling.
deploy#telemed-test:/u/apps/telemed_solutions/current$
deploy#telemed-test:/u/apps/telemed_solutions/current$ rbenv version
1.9.3-p125 (set by /home/deploy/.rbenv/version)
deploy#telemed-test:/u/apps/telemed_solutions/current$ gem list
*** LOCAL GEMS ***
bigdecimal (1.1.0)
bundler (1.1.3)
io-console (0.3)
json (1.6.6, 1.5.4)
minitest (2.12.1, 2.5.1)
rake (0.9.2)
rdoc (3.12, 3.9.4)
It might be time to upgrade rubygems. Some of the specification files may be calling rubygems methods that don't exist in your version.
Run gem --version to check your current version.
And gem update --system to upgrade to the latest.

heroku deployment error : bundler version

I have ruby 1.9.2 and rails 3.0.0 with bundler 1.0.22
when I push to heroku, I get
-----> Installing dependencies using Bundler version 1.1.rc.7
Running: bundle install --without development:test --path vendor/bundle -
-binstubs bin/
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.1.rc.7)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
why does it use bundler version 1.1.rc.7 to install the dependencies and
why does it think the current bundler version is 1.1.rc.7?
No references in the .Gemfile or the Gemfile.lock to any version.
Any input appreciated.
-Thanks
If you have the following lines in your Gemfile.lock:
PLATFORMS
x86-mingw32
be sure to delete them. And don't forget to use:
git add Gemfile Gemfile.lock