开发者

thoughtbot / paperclip Gem installation

开发者 https://www.devze.com 2023-03-26 16:16 出处:网络
Im not going to start by saying i\'m a newbie etc. Jokes, been learning Rails fornearly month using Lynda.com.I use Mac, Mac OS X Lion 10.7.

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

  1. Install bundler: gem install bundler
  2. Add to Gemfile: config.gem 'paperclip'
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号