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
Related
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.
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.
I am trying to get started with ruby on rails and whenever I try to start the server using rails server command I get the sqlite3 not found error. I tried the following:
which sqlite3
And I got the following:
/opt/local/bin/sqlite3
I am thinking that should it not be
/usr/local/bin/sqlite3
Why is it installed incorrectly on my machine? How can I fix it?
Check the output of gem list. If the sqlite gem is not in there then you need to install it.
For Rails 3 you need to add the following in your Gemfile:
gem 'sqlite'
... then run:
bundle install
For Rails 2 run:
gem install sqlite
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'
I was trying to use fancy-buttons gem in my rails 3 app but now I can not even start my local server because of this error:
$:~/rails/project$ rails server
/usr/lib/ruby/gems/1.8/gems/fancy-buttons-1.0.6/lib/fancy-buttons.rb:1: uninitialized constant Compass
(NameError)
This is what my gemfile looks like:
gem "fancy-buttons"
gem 'haml'
gem 'haml-rails'
gem 'compass', ">= 0.10.6"
I've ran bundle update and bundle install
Using haml (3.0.25)
Using compass (0.10.6)
Using fancy-buttons (1.0.6)
How can I fix this?
Compass needs to come before fancy-buttons in your gemfile. This ensures that it is loaded before fancy-buttons tries to require it as the gems in your gemfile are loaded in order.