Rails 4 Angular。在当地工作。 Heroku错误:ActiveRecord :: UnknownAttributeError(Post的未知属性'user_id'):

时间:2016-06-25 14:09:14

标签: ruby-on-rails-4 heroku

我在做AngularJS教程:学习使用Angular和Rails构建现代Web应用程序(https://thinkster.io/angular-rails#generating-activerecord-models

这是Rails,Angular与Auth的设计。

我把所有东西都运行在本地没有问题。

然而,当我部署到Heroku时,我无法发布任何内容。

我做了heroku run rake db:migrate

Heroku日志:

2016-06-25T13:45:36.516208+00:00 app[web.1]: Started GET "/" for 72.48.210.237 at 2016-06-25 13:45:36 +0000
2016-06-25T13:45:36.522910+00:00 app[web.1]: Processing by ApplicationController#angular as HTML
2016-06-25T13:45:36.524779+00:00 app[web.1]:   Rendered layouts/application.html.erb within layouts/application (0.7ms)
2016-06-25T13:45:36.525476+00:00 app[web.1]: Completed 200 OK in 2ms (Views: 1.7ms | ActiveRecord: 0.0ms)
2016-06-25T13:45:36.526191+00:00 heroku[router]: at=info method=GET path="/" host=creamrises.herokuapp.com request_id=ea5820da-f884-4336-b6af-137be0c78847 fwd="72.48.210.237" dyno
16ms status=200 bytes=1634
2016-06-25T13:45:36.722487+00:00 heroku[router]: at=info method=GET path="/assets/application-0e3cc6cc030006353593437728da2a0235194e38626ad69912085e2bf43d6b11.css" host=creamrises
1633143-8a7c-4de0-a4df-ed0a8afc3ffa fwd="72.48.210.237" dyno=web.1 connect=1ms service=4ms status=304 bytes=62
2016-06-25T13:45:36.728782+00:00 heroku[router]: at=info method=GET path="/assets/application-d023ec1c6eac1d7f4ed82825f1fdaa688bbad8ff731f298ac12d1c09b1d45ff4.js" host=creamrises.
3043a6-3960-4098-81b7-5e7e359bc0fd fwd="72.48.210.237" dyno=web.1 connect=1ms service=4ms status=304 bytes=62
2016-06-25T13:45:36.947888+00:00 app[web.1]: Processing by PostsController#index as JSON
2016-06-25T13:45:36.964323+00:00 app[web.1]:   Parameters: {"user"=>{}, "session"=>{"user"=>{}}}
2016-06-25T13:45:36.959648+00:00 app[web.1]: Completed 200 OK in 12ms (Views: 0.8ms | ActiveRecord: 9.3ms)
2016-06-25T13:45:36.961423+00:00 app[web.1]: Started POST "/users/sign_in.json" for 72.48.210.237 at 2016-06-25 13:45:36 +0000
2016-06-25T13:45:36.979621+00:00 app[web.1]:   User Load (13.4ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
2016-06-25T13:45:36.981961+00:00 app[web.1]: Completed 201 Created in 18ms (Views: 0.8ms | ActiveRecord: 13.4ms)
2016-06-25T13:45:36.959128+00:00 app[web.1]:   Post Load (9.3ms)  SELECT "posts".* FROM "posts"
2016-06-25T13:45:36.943476+00:00 app[web.1]: Started GET "/posts.json" for 72.48.210.237 at 2016-06-25 13:45:36 +0000
2016-06-25T13:45:36.964279+00:00 app[web.1]: Processing by Devise::SessionsController#create as JSON
2016-06-25T13:45:36.993960+00:00 heroku[router]: at=info method=POST path="/users/sign_in.json" host=creamrises.herokuapp.com request_id=1f390e4d-4f22-4c79-b9e1-f8ec301d2411 fwd="
onnect=1ms service=40ms status=201 bytes=1102
2016-06-25T13:45:36.963513+00:00 heroku[router]: at=info method=GET path="/posts.json" host=creamrises.herokuapp.com request_id=d53f4144-f82c-44e7-acdf-694c0d3c648a fwd="72.48.210
s service=22ms status=304 bytes=905
2016-06-25T13:45:43.103647+00:00 app[web.1]:   Parameters: {"title"=>"me me", "post"=>{"title"=>"me me"}}
2016-06-25T13:45:43.120082+00:00 app[web.1]:   User Load (6.0ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
2016-06-25T13:45:43.103638+00:00 app[web.1]: Processing by PostsController#create as JSON
2016-06-25T13:45:43.121932+00:00 app[web.1]: Completed 500 Internal Server Error in 18ms (ActiveRecord: 6.0ms)
2016-06-25T13:45:43.135785+00:00 app[web.1]:   app/controllers/posts_controller.rb:9:in `create'
2016-06-25T13:45:43.135784+00:00 app[web.1]: ActiveRecord::UnknownAttributeError (unknown attribute 'user_id' for Post.):
2016-06-25T13:45:43.135786+00:00 app[web.1]:
2016-06-25T13:45:43.099685+00:00 app[web.1]: Started POST "/posts.json" for 72.48.210.237 at 2016-06-25 13:45:43 +0000
2016-06-25T13:45:43.135774+00:00 app[web.1]:
2016-06-25T13:45:43.135786+00:00 app[web.1]:
2016-06-25T13:45:43.151268+00:00 heroku[router]: at=info method=POST path="/posts.json" host=creamrises.herokuapp.com request_id=8c4226f2-1657-4dd0-8653-24f7503b10b4 fwd="72.48.21
ms service=51ms status=500 bytes=259

0 个答案:

没有答案