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/plug开发者_如何学运维in: 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 theGemfile
is and run:bundle install
. This will install all the gems mentioned in theGemfile
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.
精彩评论