Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Activerecord Sinatra错误:NoMethodError:未定义的方法'get';对于#<;类别:0x007fa70444aef0>;_Activerecord_Sqlite_Sinatra - Fatal编程技术网

Activerecord Sinatra错误:NoMethodError:未定义的方法'get';对于#<;类别:0x007fa70444aef0>;

Activerecord Sinatra错误:NoMethodError:未定义的方法'get';对于#<;类别:0x007fa70444aef0>;,activerecord,sqlite,sinatra,Activerecord,Sqlite,Sinatra,我正在使用Sinatra和ActiveRecord创建一个站点。每当我运行我的站点时,我都会收到错误消息 启动错误 加载config.ru时出错 NoMethodError:的未定义方法“get”# /Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.2/lib/active\u record/dynamic\u matchers.rb:22:in'method\u missing' /Users/keturah

我正在使用Sinatra和ActiveRecord创建一个站点。每当我运行我的站点时,我都会收到错误消息

启动错误
加载config.ru时出错
NoMethodError:的未定义方法“get”#
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.2/lib/active\u record/dynamic\u matchers.rb:22:in'method\u missing'
/Users/keturahwalters/Desktop/Projects/char_site/app.rb:20:in`'
/Users/keturahwalters/Desktop/Projects/char_site/app.rb:9:in`'
config.ru:1:in'require'
config.ru:1:in`block in internal_app'
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:in'instance_eval'
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:在“初始化”中
config.ru:1:in'new'
config.ru:1:in'internal_app'
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/shotgun-0.9/lib/shotgun/loader.rb:112:in'eval'
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/shotgun-0.9/lib/shotgun/loader.rb:112:在“内部应用程序”中
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/shotgun-0.9/lib/shotgun/loader.rb:102:在“组装应用程序”中
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/shotgun-0.9/lib/shotgun/loader.rb:86:in“作为孩子继续”
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/shotgun-0.9/lib/shotgun/loader.rb:31:in'call!'
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/shotgun-0.9/lib/shotgun/loader.rb:18:in'call'
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/shotgun-0.9/lib/shotgun/favicon.rb:12:in'call'
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/shotgun-0.9/lib/shotgun/static.rb:14:in'call'
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:138:in'call'
/Users/keturahwalters/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:在“服务”中
/Users/keturahwalters/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:138:在“服务”中
/Users/keturahwalters/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in'run'
/Users/keturahwalters/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/server.rb:295:in'block in start_thread'
这是我的app.rb

需要“bundler”
捆绑机
需要“sinatra”
需要“sinatra/activerecord”
set:database,“sqlite3:///events.db”
类联系人
这是我的config.ru

需要“/app”
运行Sinatra::应用程序

有人知道问题出在哪里吗?

您继承了
ActiveRecord::Base
,但这是针对数据库模型的。将路由放在继承自
Sinatra::Base
的类中,并确保
也需要“Sinatra/Base”