DataMapper No Memory Error - Sinatra
Any ideas as to where I am going wrong here?
Error:
C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:291:in `next!': failed to allocate memory (NoMemoryError)
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:291:in `select_fields'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:39:in `select'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:276:in `with_connection'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:33:in `select'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-mysql-adapter.rb:99:in `show_variable'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-mysql-adapter.rb:89:in `character_set'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-mysql-adapter.rb:54:in `create_table_statement'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:94:in `create_model_storage'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb:276:in `with_connection'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:93:in `create_model_storage'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:57:in `upgrade_model_storage'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:71:in `upgrade_model_storage'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:143:in `auto_upgrade!'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:45:in `send'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:45:in `repository_execute'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-core-1.1.0/lib/dm-core/support/descendant_set.rb:66:in `each'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-core-1.1.0/lib/dm-core/support/subject_set.rb:212:in `each'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-core-1.1.0/lib/dm-core/support/ordered_set.rb:321:in `each'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-core-1.1.0/lib/dm-core/support/ordered_set.rb:321:in `each'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-core-1.1.0/lib/dm-core/support/subject_set.rb:212:in `each'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-core-1.1.0/lib/dm-core/support/descendant_set.rb:65:in `each'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:44:in `repository_execute'
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/auto_migration.rb:27:in `auto_upgrade!'
from list.rb:51
Code:
require 'rubygems'
require 'sinatra'
require 'omniauth/oau开发者_Go百科th'
require 'rest-graph'
require 'hashie/hash'
require 'dm-core'
require 'dm-serializer/to_json'
require 'dm-migrations'
require 'dm-timestamps'
require 'dm-validations'
require 'dm-mysql-adapter'
enable :sessions
APP_ID = "XXXXX"
APP_SECRET = "XXXX"
SQLCONN = "mysql://XXXXXXX"
DataMapper.setup(:default, SQLCONN)
class Person
include DataMapper::Resource
property :id, Serial
property :FBid, String
property :visits, Integer
property :first_visit, DateTime
property :recent_visit, DateTime
property :token, String
has n, :links
end
class Link
include DataMapper::Resource
property :id, Serial
property :created, DateTime
property :deactivated, DateTime
property :active, Boolean
belongs_to :person
def self.currentLinks
all(:active == true)
end
end
DataMapper.auto_upgrade!
all(:active == true)
try...
all(:active => true)
精彩评论