ruby on rails gem error - No such file to load - ruby-on-rails-3

I am trying to use the koala gem per these instructions: https://github.com/arsduo/koala/wiki
I did a gem install koala. I see the gem in the list of installed gems.
The instructions say to add
require 'rubygems'
require 'koala'
It doesn't say where. I tried it to add the lines to the beginning of one of my controllers.
Then I also tried it in the initializer file:
C:\Documents and Settings\mtariq\blog\config\initializers\koala.rb
I always get the same error:
no such file to load -- koala
I installed the gem.. so what 'file' is it trying to load?
Any help would be appreciated. I know I must be doing something stupid but can't find any clues.
Mariam

Assuming you are running rails 3, just add the koala gem to your Gemfile, then run 'bundle install'. No need to require any library.
# Gemfile
gem 'koala'

Related

Bundler::GemRequireError when adding gem

When I make a new Rails project, add gem 'reactive-record', and run rails server, I get a Bundler error: There was an error while trying to load the gem 'reactive-record'. (Bundler::GemRequireError).
What gives? I have Rails 4.2.5 and Ruby 2.1.2.
Cheers!
The latest version of the generator should work very well with the help of Mitch. We collaborated together to make a generator in order to simplify greatly the installation of react.rb and reactive-record.
You should be able to get up and running by adding to your gem file :
gem 'reactive_rails_generator'
Then do a bundle install
and finally :
rails g reactrb:install --all
bundle update
Will install you reactrb, reactive-record and reactive-router.
Once installed, you can create components by doing :
rails g reactrb:component Home::Show
I worked around the problem like this:
Set rvm to use Ruby 2.2.2 and Rails 4.2.4.
Download https://codeload.github.com/catprintlabs/reactive-record/zip/master
Edited reactive-record-master/Gemfile to read:
gem 'reactive-ruby'
gem 'opal'
gem 'opal-browser'
gem 'react-rails'
cd reactive-record-master/spec/test_app
bundle install
rails server
This seemed to work.
Then, I made a new Rails 4.2.4 project. Adding only gem 'reactive-record' to the Gemfile resulted in the same error. Then I made the Gemfile read:
gem 'reactive-ruby'
gem 'opal'
gem 'opal-browser'
gem 'react-rails'
gem 'reactive-record'
And voila, rails server works!
Hope this helps someone else.

gem not working after installing 'thin' - rails 3.2.8

I got stuck in a dead end after trying to install the gem 'thin' on the environment
RHEL 6.0
Ruby 1.9.3
Rails 3.2.8
As indicated, I added
gem 'thin'
to my Gemfile and ran
bundle install
The installation seemed to be successful, but after that, whenever I run 'gem', I get
<internal:prelude>:8:in `lock': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
ERROR: Failed to build gem native extension.
deadlock; recursive locking
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/extensions/x86_64-linux/1.9.1-static/eventmachine-1.0.3/gem_make.out
While if I run again 'bundle install' I get
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at
http://bit.ly/bundler-issues. Thanks!
<internal:prelude>:8:in `lock': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
ERROR: Failed to build gem native extension.
deadlock; recursive locking
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/extensions/x86_64-linux/1.9.1-static/eventmachine-1.0.3/gem_make.out
I even tried to follow troubleshooting at https://github.com/bundler/bundler/blob/master/ISSUES.md but nothing has changed.
Looks like there's something corrupted in the eventmachine gem installation, but I can't neither uninstall or reinstall it.
Has anybody got an idea?
I would like at least to be able to revert to the (working) configuration prior to thin installation....

How to add TMail to Rails app

I thought TMail was included in Rails. But when I try to call it, I got error:
email = TMail::Mail.parse("From mikel#example.org\nReceived by.... etc")
NameError: uninitialized constant TMail
When I require 'tmail' on my console, I also got error:
require 'tmail'
LoadError: cannot load such file -- tmail
I already installed tmail using sudo gem install tmail
My question is: how can I add TMail to Rails app? I am using Rails 3.2.12.
Add the gem inside your Gemfile
gem 'tmail'
then run bundle install

Trying to debug ruby 1.9.3p194 rails 3.2.7

Arg, looks like this is a fairly common problem but I can't seem to figure out how to get my debugger working. I've installed a myriad of gems to try to get this bad boy running but no luck. Here is a list for completeness. I've included my gemfile as well. As is probably quite obvious I'm a RoR newb. I'm using RubyMine as my IDE and upon trying to debug I get an error that states "The gem ruby-debug-base19x required by the debugger is not currently installed. Would you like to install it?". Of course, upon saying 'yes' to download the mirror is broken and the download fails resulting in the following error:
5:56:46 PM Error running Development: SponsorBid: Cannot start
debugger. Gem 'ruby-debug-ide' isn't installed or its executable
script 'rdebug-ide' doesn't exist.
Even though this question duplicates two other questions here, I'll answer it for the sake of completeness.
In order to debug from RubyMine you must use only 2 debug gems:
ruby-debug-base19x
ruby-debug-ide
Exactly these gems must be used, not ruby-debug-base19, not ruby-debug19, not debugger . All the other debug gems must be uninstalled and removed from the Gemfile.
See this answer for the details how to install proper debug gem versions. If you have a problem downloading linecache19-0.5.13.gem gem, try this mirror instead.
Verify with gem list that you have the following or more recent versions installed:
ruby-debug-base19x (0.11.30.pre10)
ruby-debug-ide (0.4.17.beta9)
No other debug gems should be listed by this command.
As stated in another answer, debugger gem must not be used, it will conflict with the debug gems used by RubyMine and debugger will not work. You must uninstall this gem, remove it from the Gemfile and ensure that your code doesn't call any methods from this gem and is not trying to load it.
Happy debugging!
As suggested by #Anjan, your Gemfile for debugging can look like this:
gem 'linecache19', '>= 0.5.13', :git => 'https://github.com/robmathews/linecache19-0.5.13.git'
gem 'ruby-debug-base19x', '>= 0.11.30.pre10'
gem 'ruby-debug-ide', '>= 0.4.17.beta14'`
Just run bundle install to get the proper versions of the required debug gems.
This is what I used in my Gemfile to install the required gems through bundler:
gem 'linecache19', '>= 0.5.13', :git => 'https://github.com/robmathews/linecache19-0.5.13.git'
gem 'ruby-debug-base19x', '>= 0.11.30.pre10'
gem 'ruby-debug-ide', '>= 0.4.17.beta14'`
No manual gem installation required and will automatically work on your fellow developers' computers.

thoughtbot / paperclip Gem installation

Im not going to start by saying i'm a newbie etc. Jokes, been learning Rails for nearly month using Lynda.com. I use Mac, Mac OS X Lion 10.7.
I am trying to intall Paperclip Gem but i can't seem to figure out what i'm doing wrong.
I followed the instructions on https://github.com/thoughtbot/paperclip/wiki/Installation
I added this line to my config/environment.rb
config.gem 'paperclip', :source => 'http://rubygems.org'
and i then tried to run
rake gems:install
I get an error message:
(in /Users/fred/Ruby/food)
rake aborted!
undefined local variable or method `config' for main:Object
/Users/fred/Ruby/food/Rakefile:4:in `require'
(See full trace by running task with --trace)
I then tried the following as an alternative when the above failed
script/plugin install git://github.com/thoughtbot/paperclip
I get the following error
-bash: script/plugin: No such file or directory
My question is how do install this gem? I have read a lot of other posts that say i should include gem 'paperclip', "~> 2.3" is this the same as what i did above?
Best to use bundler. Steps are
Install bundler: gem install bundler
Add to Gemfile: config.gem 'paperclip'
cd to where the Gemfile is and run: bundle install. This will install all the gems mentioned in the Gemfile
Ps. I assume that you are not using rvm. Also, you may need to prefix sudo to the command in step 1 above in case the command does not work for you due to a permission problem.