I am following rails casts episode 192 for cancan (http://railscasts.com/episodes/192-authorization-with-cancan?autoplay=true).

I have ruby 1.9.3 and rails 3.2.3

My gem file has this content

group :test, :development do
   gem 'rspec-rails', '~> 2.5'
end
group :test do 
   gem 'cucumber-rails', '1.0.6'# use this instead of the one in the book
   gem 'capybara'
   gem 'database_cleaner'
end

gem 'dynamic_form'
gem 'factory_girl'
gem 'devise', '~>1.4.3'
gem 'email_spec'
gem 'cancan'

and in the environment.rb file I have added

config.gem 'cancan'

when I run bundle command I see this...

Using warden (1.0.6) 
Using devise (1.4.9) 
Using dynamic_form (1.1.4) 
Using rspec-core (2.11.0) 
Using rspec-expectations (2.11.1) 
Using rspec-mocks (2.11.0) 
Using rspec (2.11.0) 

Now my question is: when I run:

sudo rake gems:install

then why do I see this:

Could not find warden-1.0.6 in any of the sources
Run `bundle install` to install missing gems.

and also in my gem.lock file why does it show...

devise (1.4.9)
  bcrypt-ruby (~> 3.0)
  orm_adapter (~> 0.0.3)
  warden (~> 1.0.3)
有帮助吗?

解决方案

That railscast is from Dec 14, 2009 back when Rails 2 was the standard.

You should go through the instructions at https://github.com/ryanb/cancan which focus more on Rails 3 and Bundler.

bundle install will install your Gemfile contents into your current RVM gemset, in this case, probably the default gemset. Do NOT use sudo to install gems. To list the gems installed in the gemset, just run gem list. Run bundle list to show all of the gems in the current application bundle.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top