On Sun, Mar 31, 2013 at 9:32 AM, jonathan kav [email protected]
but i keep getting this error message:
Whatshould I to do?
Posted via http://www.ruby-forum.com/.
ActiveRecord is a class that talks to databases, this gem is expecting
be run in a context with a database connection to ActiveRecord loaded.
you’re in Rails, that means loading your Rails environment. Or if just
ActiveRecord, something like this will work:
ActiveRecord::Base.establish_connection adapter: ‘sqlite3’, database:
self.verbose = false
create_table :users do |t|
t.integer :friends_count, :default => 0, :null => false
create_table :friendships, :force => true do |t|
t.references :user, :friend
t.datetime :requested_at, :accepted_at, :denied_at, :blocked_at
create_table :blocked_users, :force => true do |t|
t.references :user, :blocked_user
change_table :friendships do |t|
change_table :blocked_users do |t|
class User < ActiveRecord::Base
john = User.create! name: ‘john’
mary = User.create! name: ‘mary’
paul = User.create! name: ‘paul’
john.friends?(mary) # => false
mary.friends?(john) # => true
But to be honest, if you don’t know what ActiveRecord is, then it seems
improbable that this gem will be solving problems for you. Also, I’d be
bit skeptical of this gem, it has a misspelling in its migration such
it doesn’t actually work unless you go fix it.
has been broken for at least 7 months without being fixed. There’s <
800 downloads of the gem, which is not many (few users = fewer people
finding and fixing bugs), and it doesn’t look like the author is
to maintain it.
Okay, I just realized what is actually happening. Took about 20 min to
write that up above, and it might help someone later googling for an
so I’m going to leave it. What really happened, I suspect, is that you
have a gem on your system named circle, and you have a file probably in
your same directory named circle. Your load path is not properly set, so
require 'circle', it is finding the gem and not the file you
wrote. A simple answer is to say
require File.dirname(__FILE__) + '/circle' instead of
require 'circle' This isn’t really the right
answer, but it will work without going into the myriad of nuances
to figure out what the right thing is. If you want to figure out what
right thing is, I’d need to know what Ruby version you’re on, how you’re
intending to use and invoke this code, and what your directory structure
Also. If you would have said that circle.rb was a file in the same
directory, then I wouldn’t have lost 20 min with the top answer. You
provide sufficient context in the future to understand the problem.