小编Sta*_*ids的帖子

在Ruby on Rails html.erb文件中循环

每个人我都是Ruby on Rails的新手,我需要了解一些东西.我有一个实例变量(@users),我需要在html.erb文件中循环它限制次数.我已经用过了:

<% @users.each do |users| %>
   <%= do something %>
<%end %>
Run Code Online (Sandbox Code Playgroud)

但是,我需要将其限制为10次.我能做什么?

html ruby loops ruby-on-rails erb

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

Android Google+登录无效 - statusCode = SIGN_IN_REQUIRED

我想让用户使用Google+登录.我在Google开发者控制台中创建了该项目,我获得了客户端ID,并在Android Studio中安装了Google Play服务.(我的运行设备有Android 4.4.2)当应用程序运行时我按下登录按钮会出现一个Toast消息:"Internal Error"

Logcat中的错误如下:

error ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{429ffe38: android.os.BinderProxy@429ffdd8}}
Run Code Online (Sandbox Code Playgroud)

请注意,在用户按下按钮之前出现此错误,事实上,通过调试,我发现它来自此行代码:

Log.e(TAG, "error " + result.toString());
Run Code Online (Sandbox Code Playgroud)

在方法中:

public void onConnectionFailed(ConnectionResult result) {
    if (!mGoogleIntentInProgress) {
        /* Store the ConnectionResult so that we can use it later when the user clicks on the Google+ login button */
        mGoogleConnectionResult = result;

        if (mGoogleLoginClicked) {
            /* The user has already clicked login so we attempt to resolve all errors until the user is signed in,
             * or they cancel. */
            resolveSignInError();
        } else …
Run Code Online (Sandbox Code Playgroud)

authentication android login google-plus android-pendingintent

3
推荐指数
1
解决办法
5821
查看次数