Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to require ActiveResource

I want to test my RESTful resource in Rails:

require 'rubygems'
require 'activeresource'

class Event < ActiveResource::Base
  self.site = "http://localhost:3000"
end

events = Event.find(:all)
puts events.map(&:name)

I have installed gem:

gem install activeresource

But when I launch my code I get the error message:

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- activeresource (LoadError)
        from <internal:lib/rubygems/custom_require>:29:in `require'
        from service.rb:2:in `<main>'

How can I require ActiveResource?

like image 592
ceth Avatar asked Dec 02 '22 02:12

ceth


1 Answers

There is a typo in your require, the following is the correct one:

require 'active_resource'
like image 197
BFil Avatar answered Dec 04 '22 11:12

BFil