[英]Rails 4 on Heroku with 'protected_attributes' gem
I don't know where else to turn with this: I have spent many hours on my project, a recruiting events website for college students, but have reached quite the impasse. 我不知道该怎么办:我在我的项目上花了很多时间,这是一个针对大学生的招聘活动网站,但已经陷入僵局。
In short, I plodded along in localhost - adding components like Devise; 简而言之,我走进了localhost-添加了诸如Devise之类的组件; Omniauth authentication via providers Facebook, LinkedIn, and Google - building a website I was proud of along the way.
通过提供者Facebook,LinkedIn和Google进行Omniauth身份验证-建立一个让我感到骄傲的网站。 Everything appeared to be working just fine, but once I pushed to 'heroku master' things started breaking big time.
一切似乎都运行良好,但是一旦我推向“ heroku master”,事情就开始破烂了。
I think the issues are most likely in or around:I have an Authentication model to keep track of a single user's authentication providers, alongside the User model (where all the oauth code is kept). 我认为问题最有可能发生在周围或周围:我有一个身份验证模型来跟踪单个用户的身份验证提供程序,以及用户模型(其中保留了所有oauth代码)。
Without further ado, here is my app's heroku domain and my code: 事不宜迟,这是我的应用程序的heroku域和代码:
http://lit-everglades-7633.herokuapp.com/ http://lit-everglades-7633.herokuapp.com/
https://gist.github.com/mecampbellsoup/6357855 https://gist.github.com/mecampbellsoup/6357855
The things breaking which I suspect are related: 我怀疑与破坏有关的是:
the routing and action relating to the omniauth request seems to be working just fine, according to the heroku logs (below) but no user nor authentication is actually created: 根据heroku日志(如下),与omniauth请求有关的路由和操作似乎工作正常,但实际上未创建用户或身份验证:
when, after resetting postgres db, I try to run 'heroku run rake db:create' or 'db:setup' I am whined at as follows: 重置postgres db后,当我尝试运行'heroku run rake db:create'或'db:setup'时,我抱怨如下:
☁ duke_recruits [master] heroku run rake db:setup
☁duke_recruits [master] heroku run rake db:setup
Runningrake db:setup
attached to terminal... up, run.5886运行
rake db:setup
附加到终端...运行5886
FATAL: permission denied for database "postgres"严重:数据库“ postgres”的权限被拒绝
DETAIL: User does not have CONNECT privilege.详细信息:用户没有CONNECT特权。
☁ duke_recruits [master] heroku run rake db:seed
ke duke_recruits [master] heroku run rake db:seed
Runningrake db:seed
attached to terminal... up, run.1767正在运行
rake db:seed
附加到终端...运行1767☁ duke_recruits [master] heroku run rails c
ke duke_recruits [master] heroku run rails c
Runningrails c
attached to terminal... up, run.6135rails c
连接到终端...向上运行6135
Event.allLoading production environment (Rails 4.0.0)Event.allLoading生产环境(Rails 4.0.0)
irb(main):001:0> Event.allirb(main):001:0> Event.all
=> #ActiveRecord::Relation [#Event id: 1, title: nil, location: nil, description: nil, date: nil, end_date: nil, company_id: nil, created_at: "2013-08-27 19:30:06", updated_at: "2013-08-27 19:30:06"]=> #ActiveRecord :: Relation [#Event id:1,标题:nil,位置:nil,描述:nil,日期:nil,结束日期:nil,company_id:nil,created_at:“ 2013-08-27 19:30: 06”,updated_at:“ 2013-08-27 19:30:06”]
irb(main):002:0> Company.allirb(main):002:0> Company.all
=> #ActiveRecord::Relation [#Company id: 1, name: nil, description: nil, website: nil, logo: nil, created_at: "2013-08-27 19:30:06", updated_at: "2013-08-27 19:30:06"]=> #ActiveRecord :: Relation [#Company id:1,名称:nil,描述:nil,网站:nil,徽标:nil,created_at:“ 2013-08-27 19:30:06”,updated_at:“ 2013- 08-27 19:30:06“]
Logs (upon opening the app on heroku and trying google authentication): 日志(在heroku上打开应用并尝试Google身份验证时):
2013-08-27T19:49:18.701285+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:49:18 +00002013-08-27T19:49:18.701285 + 00:00 app [web.1]:在2013-08-27 19:49:18 +0000处以68.175.76.48的价格开始获取“ /”
2013-08-27T19:49:18.701019+00:00 app[web.1]: => Rails 4.0.0 application starting in production on http://0.0.0.0:497102013-08-27T19:49:18.701019 + 00:00 app [web.1]:=> Rails 4.0.0应用程序开始在http://0.0.0.0:49710上投入生产
2013-08-27T19:49:18.701019+00:00 app[web.1]: => Ctrl-C to shutdown server2013-08-27T19:49:18.701019 + 00:00 app [web.1]:=> Ctrl-C关闭服务器
2013-08-27T19:49:18.701019+00:00 app[web.1]: => Booting WEBrick2013-08-27T19:49:18.701019 + 00:00 app [web.1]:=>正在启动WEBrick
2013-08-27T19:49:18.701019+00:00 app[web.1]: => Run `rails server -h` for more startup options2013-08-27T19:49:18.701019 + 00:00 app [web.1]:=>运行`rails server -h`获取更多启动选项
2013-08-27T19:49:18.701019+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:49:18 +00002013-08-27T19:49:18.701019 + 00:00 app [web.1]:在2013-08-27 19:49:18 +0000处为68.175.76.48开始获取“ /”
2013-08-27T19:49:19.131115+00:00 heroku[router]: at=info method=GET path=/ host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=2ms service=442ms status=304 bytes=02013-08-27T19:49.19115 + 00:00 heroku [router]:at = info method = GET path = / host = lit-everglades-7633.herokuapp.com fwd =“ 68.175.76.48” dyno = web.1 connect = 2ms服务= 442ms状态= 304字节= 0
2013-08-27T19:49:19.221284+00:00 heroku[router]: at=info method=GET path=/assets/application-b44a43097f814ac98347f6802323e25f.js host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=1ms service=12ms status=304 bytes=02013-08-27T19:49:19.221284 + 00:00 heroku [router]:at = info method = GET path = / assets / application-b44a43097f814ac98347f6802323e25f.js host = lit-everglades-7633.herokuapp.com fwd =“ 68.175。 76.48“ dyno = web.1 connect = 1ms服务= 12ms状态= 304字节= 0
2013-08-27T19:49:49.440894+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:49:49 +00002013-08-27T19:49:49.440894 + 00:00 app [web.1]:在2013-08-27 19:49:49 +0000处以68.175.76.48的价格开始获取“ /”
2013-08-27T19:49:49.440894+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:49:49 +00002013-08-27T19:49:49.440894 + 00:00 app [web.1]:在2013-08-27 19:49:49 +0000处以68.175.76.48的价格开始获取“ /”
2013-08-27T19:49:49.515520+00:00 heroku[router]: at=info method=GET path=/ host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=2ms service=80ms status=304 bytes=02013-08-27T19:49.515520 + 00:00 heroku [router]:at = info method = GET path = / host = lit-everglades-7633.herokuapp.com fwd =“ 68.175.76.48” dyno = web.1 connect = 2ms服务= 80ms状态= 304字节= 0
2013-08-27T19:50:48.534099+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:50:48 +00002013-08-27T19:50:48.534099 + 00:00 app [web.1]:在2013-08-27 19:50:48 +0000处以68.175.76.48的价格开始获取“ /”
2013-08-27T19:50:48.534099+00:00 app[web.1]: Started GET "/" for 68.175.76.48 at 2013-08-27 19:50:48 +00002013-08-27T19:50:48.534099 + 00:00 app [web.1]:在2013-08-27 19:50:48 +0000处以68.175.76.48的价格开始获取“ /”
2013-08-27T19:50:48.575279+00:00 heroku[router]: at=info method=GET path=/ host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=1ms service=51ms status=304 bytes=02013-08-27T19:50:48.575279 + 00:00 heroku [router]:at = info method = GET path = / host = lit-everglades-7633.herokuapp.com fwd =“ 68.175.76.48” dyno = web.1 connect = 1ms服务= 51ms状态= 304字节= 0
2013-08-27T19:50:52.293922+00:00 app[web.1]: Started GET "/users/sign_up" for 68.175.76.48 at 2013-08-27 19:50:52 +00002013-08-27T19:50:52.293922 + 00:00 app [web.1]:在2013-08-27 19:50:52 +0000处以68.175.76.48的价格开始获取“ / users / sign_up”
2013-08-27T19:50:52.293922+00:00 app[web.1]: Started GET "/users/sign_up" for 68.175.76.48 at 2013-08-27 19:50:52 +00002013-08-27T19:50:52.293922 + 00:00 app [web.1]:在2013-08-27 19:50:52 +0000处以68.175.76.48的价格开始获取“ / users / sign_up”
2013-08-27T19:50:52.591752+00:00 heroku[router]: at=info method=GET path=/users/sign_up host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=1ms service=307ms status=304 bytes=02013-08-27T19:50:52.591752 + 00:00 heroku [router]:at = info method = GET path = / users / sign_up host = lit-everglades-7633.herokuapp.com fwd =“ 68.175.76.48” dyno = web.1 connect = 1ms服务= 307ms状态= 304字节= 0
2013-08-27T19:51:00.368352+00:00 app[web.1]: Started GET "/users/auth/google_oauth2" for 68.175.76.48 at 2013-08-27 19:51:00 +00002013-08-27T19:51:00.368352 + 00:00 app [web.1]:在2013-08-27 19:51:00 +0000处以68.175.76.48的价格开始获取“ / users / auth / google_oauth2”
2013-08-27T19:51:00.368352+00:00 app[web.1]: Started GET "/users/auth/google_oauth2" for 68.175.76.48 at 2013-08-27 19:51:00 +00002013-08-27T19:51:00.368352 + 00:00 app [web.1]:在2013-08-27 19:51:00 +0000处以68.175.76.48的价格开始获取“ / users / auth / google_oauth2”
2013-08-27T19:51:00.368926+00:00 app[web.1]: I, [2013-08-27T19:51:00.368823 #2] INFO -- omniauth: (google_oauth2) Request phase initiated.2013-08-27T19:51:00.368926 + 00:00 app [web.1]:我,[2013-08-27T19:51:00.368823#2]信息-omniauth:(google_oauth2)请求阶段已启动。
2013-08-27T19:51:00.392262+00:00 heroku[router]: at=info method=GET path=/users/auth/google_oauth2 host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=3ms service=33ms status=302 bytes=4692013-08-27T19:51:00.392262 + 00:00 heroku [router]:at = info method = GET path = / users / auth / google_oauth2 host = lit-everglades-7633.herokuapp.com fwd =“ 68.175.76.48” dyno = web.1 connect = 3ms service = 33ms status = 302字节= 469
2013-08-27T19:51:00.715597+00:00 app[web.1]: Started GET "/users/auth/google_oauth2" for 68.175.76.48 at 2013-08-27 19:51:00 +00002013-08-27T19:51:00.715597 + 00:00 app [web.1]:在2013-08-27 19:51:00 +0000处以68.175.76.48的价格开始获取“ / users / auth / google_oauth2”
2013-08-27T19:51:00.715597+00:00 app[web.1]: Started GET "/users/auth/google_oauth2" for 68.175.76.48 at 2013-08-27 19:51:00 +00002013-08-27T19:51:00.715597 + 00:00 app [web.1]:在2013-08-27 19:51:00 +0000处以68.175.76.48的价格开始获取“ / users / auth / google_oauth2”
2013-08-27T19:51:00.716822+00:00 app[web.1]: I, [2013-08-27T19:51:00.716706 #2] INFO -- omniauth: (google_oauth2) Request phase initiated.2013-08-27T19:51:00.716822 + 00:00 app [web.1]:I,[2013-08-27T19:51:00.716706#2] INFO-omniauth:(google_oauth2)请求阶段已启动。
2013-08-27T19:51:00.997866+00:00 app[web.1]: Started GET "/users/auth/google_oauth2/callback?state=40ecfd10739cb874b5c461fc00cfd72ec4fcb694ef3a6878&code=4/D_(omitted_for_security)_GBlmiYhY(partially_omitted)E9yth.QpxI3jdcGpYYshQV0ieZDAoQOqyCgQI" for 68.175.76.48 at 2013-08-27 19:51:00 +00002013-08-27T19:51:00.997866 + 00:00 app [web.1]:开始GET“ / users / auth / google_oauth2 / callback?state = 40ecfd10739cb874b5c461fc00cfd72ec4fcb694ef3a6878&code = 4 / D_(omitted_for_security)_GBLyYQYyQYyQYyQYyQ在2013-08-27 19:51:00 +0000时为68.175.76.48
2013-08-27T19:51:00.997866+00:00 app[web.1]: Started GET "/users/auth/google_oauth2/callback?state=10739cb874b5c461fc00cfd72ec4fcb694ef3a6878&code=4/D_GBlmiYhY1rCvgdgE9yth.QpxI3jdcGpYYshQV0ieZDAoQOqyCgQI" for 68.175.76.48 at 2013-08-27 19:51:00 +00002013-08-27T19:51:00.997866 + 00:00应用程式[web.1]:开始GET “/users/auth/google_oauth2/callback?state=10739cb874b5c461fc00cfd72ec4fcb694ef3a6878&code=4/D_GBlmiYhY1rCvgdgE9yth.QpxI3jdcGpYYshQV0ieZDAoQOqyCgQI” 为68.175.76.48在2013-08 -27 19:51:00 +0000
2013-08-27T19:51:00.998508+00:00 app[web.1]: I, [2013-08-27T19:51:00.998379 #2] INFO -- omniauth: (google_oauth2) Callback phase initiated.2013-08-27T19:51:00.998508 + 00:00 app [web.1]:I,[2013-08-27T19:51:00.998379#2] INFO-omniauth:(google_oauth2)回调阶段已启动。
2013-08-27T19:51:02.188467+00:00 app[web.1]: Started GET "/users/sign_up" for 68.175.76.48 at 2013-08-27 19:51:02 +00002013-08-27T19:51:02.188467 + 00:00 app [web.1]:在2013-08-27 19:51:02 +0000处以68.175.76.48的价格开始获取“ / users / sign_up”
2013-08-27T19:51:02.188467+00:00 app[web.1]: Started GET "/users/sign_up" for 68.175.76.48 at 2013-08-27 19:51:02 +00002013-08-27T19:51:02.188467 + 00:00 app [web.1]:在2013-08-27 19:51:02 +0000处以68.175.76.48的价格开始获取“ / users / sign_up”
2013-08-27T19:51:02.234644+00:00 heroku[router]: at=info method=GET path=/users/sign_up host=lit-everglades-7633.herokuapp.com fwd="68.175.76.48" dyno=web.1 connect=9ms service=52ms status=304 bytes=02013-08-27T19:51:02.234644 + 00:00 heroku [router]:at = info method = GET path = / users / sign_up host = lit-everglades-7633.herokuapp.com fwd =“ 68.175.76.48” dyno = web.1 connect = 9ms服务= 52ms状态= 304字节= 0
Please let me know what questions you have for me and if I can clarify anything at all. 请让我知道您对我有什么疑问,以及我是否可以澄清任何问题。 I really appreciate your time & help SO!
非常感谢您的宝贵时间,并提供帮助!
After a pg:reset, you can run the create command, but it usually gives you output like: 在pg:reset之后,您可以运行create命令,但是它通常会为您提供如下输出:
slkdjfs0dslkd already exists
So then you'll know that your database is created and ready to be used. 因此,您将知道数据库已创建并可以使用。 Before you can seed though make sure you migrate.
在确定种子之前,请确保已迁移。 Just the standard heroku way
只是标准的Heroku方式
heroku run rake db:migrate
Then seed as normal 然后照常播种
heroku run rake db:seed
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.