小编Nao*_*i K的帖子

PG不可定义的错误关系用户不存在

我之前看到过这个问题,但仅限于rspec.我还没有进行测试,因为它对我来说太进步了,但有一天我会尽快!:P

当我尝试使用我的应用注册/登录时出现此错误.我不知道在哪里修理它.我使用devise来创建我的用户,并使用omn​​iauth2来登录谷歌.

这是错误

ActiveRecord::StatementInvalid at /users/auth/google_oauth2/callback
PG::UndefinedTable: ERROR:  relation "users" does not exist
LINE 5:              WHERE a.attrelid = '"users"'::regclass
                                        ^
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
              FROM pg_attribute a LEFT JOIN pg_attrdef d
                ON a.attrelid = d.adrelid AND a.attnum = d.adnum
             WHERE a.attrelid = '"users"'::regclass
               AND a.attnum > 0 AND NOT a.attisdropped
             ORDER BY a.attnum
Run Code Online (Sandbox Code Playgroud)

我试过rake db:migrate,但它已经创建,在架构表中存在用户.有没有人以前得到这个错误?

database.yml的

#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# …
Run Code Online (Sandbox Code Playgroud)

database ruby-on-rails oauth-2.0 rake-task ruby-on-rails-3

88
推荐指数
8
解决办法
8万
查看次数

如何始终保持两个div并排

我有两个div左移.我真的不想使用绝对位置,是否有另一种方法来保持并排而不使用绝对位置?或者这是唯一的方法吗?

<div class="moreinfo" id="darkgray">
            <p>
                Today, hate speech continues to profilerate throughout the Internet, normalized in the form of YouTube comments, animated GIFs, and tweets. Online anonymity affords users a sense of security that fosters a culture of cruelty and bigotry. Our goal is to create a conversation about the consequences of hateful speech that rethinks how we communicate online. Social media is full of positive potential; we can tap into it by holding each other accountable.
            </p>
        </div>
        <div …
Run Code Online (Sandbox Code Playgroud)

html css

4
推荐指数
2
解决办法
1万
查看次数

如何使用设计和cancan使管理员用户?

我设置了设计和cancan,但是如何让1个用户管理员和其他用户不是管理员?我是否使用omniauth(我只想使用google登录),设计或cancan?

ruby-on-rails devise cancan omniauth

2
推荐指数
1
解决办法
8943
查看次数

如何防止我的 jquery 模式滚动到窗口顶部?

嗨,我认为当我单击表单按钮时,模式将用户带到页面的开头,这很丑陋。我宁愿它留在用户当前在页面上的位置。这可能吗?

$(".buttons").click(function(){
        $("#overlay-modal").fadeIn();
    });
    $(document).mousedown(function(e){
            var clicked = $(e.target);
        if (clicked.is('.inner-modal') || clicked.parents().is('.inner-modal')){
                return;
            } else { $('#overlay-modal').hide();
        }
    });
 });
Run Code Online (Sandbox Code Playgroud)

这就是我目前所拥有的。我尝试在我希望页面保留的位置的底部添加一个锚标记,但这不起作用。我还尝试移动表单在页面上的位置。

html css jquery

2
推荐指数
1
解决办法
1745
查看次数