小编Eze*_*iro的帖子

为'ParameterSanitizer设计NoMethodError'

我每次尝试在网上唱歌/唱歌时都会遇到错误.

Heroku日志:

Started GET "/users/sign_in" for 201.235.89.150 at 2016-07-06 01:35:03 +0000
 Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.0ms)
NoMethodError (undefined method `for' for #<Devise::ParameterSanitizer:0x007f5968e0a920>):
 app/controllers/application_controller.rb:11:in `configure_permitted_parameters'
Run Code Online (Sandbox Code Playgroud)

application_controller.rb

class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  before_filter :configure_permitted_parameters, if: :devise_controller?

    protected

        def configure_permitted_parameters
            devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :provider, :uid) }
            devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :current_password) }
        end
end …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails heroku devise

13
推荐指数
1
解决办法
5661
查看次数

Angularjs mdDialog - 如何将数据发送回我的第一个控制器

我使用完美运行的“locals”属性向我的 md-Dialog 发送了一些信息。用户按下按钮后,他将通过 $resource 方法发送一些信息并获得响应。我需要在 md 对话框关闭后显示该响应。如何将该响应发送给我的第一个控制器?

这是示例:

 //Main controller
 app.controller('Postulation_Ctrl', function($scope, $mdDialog,Postulation, Lista_Complejos){

//md-dialog function
    $scope.showPrompt = function(ev){
        var parentEl = angular.element(document.body);

    var confirm = $mdDialog.show({
         parent: parentEl,
         locals: {

            values: $scope.values,
         },
         targetEvent: ev,
         t templateUrl: 'view/example.html',
         controller: function DialogController($scope, $mdDialog, valores, postulaciones,user_id, Postulation) {

        $scope.result = values;
      
        $scope.createPostulation = function(){
            
    
                $scope.postulation = {};
        //some logic
            
        auxPostulation = new Postulation($scope.postulation);
        auxPostulation.$save(null, function(){
        $scope.queryPost();
                );
            }

        $mdDialog.hide();
        }

$scope.queryPost = function() { 
    Postulation.query(function(response){
    $scope.postulations = response; <----------I NEED TO …
Run Code Online (Sandbox Code Playgroud)

controller angularjs angular-material mddialog

5
推荐指数
1
解决办法
4213
查看次数

Ngmessages Uncaught TypeError l.module(...).info不是函数

我已经将Angular-Messages安装到我的Ionic V1应用程序中,但我无法使其正常工作.

错误:

Uncaught TypeError: l.module(...).info is not a function at angular-messages.js:267
at angular-messages.js:6
Run Code Online (Sandbox Code Playgroud)

这是我的index.html:

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>
    <script src="js/sha1.js"></script>

<script src="lib/ionic-material/dist/ionic.material.min.js"></script>
<script src="lib/angular-messages/angular-messages.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

在我的app.js

var app = angular.module('starter', ['ionic', 'ngCordovaOauth', 'ionic-material', 'ngMessages'])
Run Code Online (Sandbox Code Playgroud)

读一点我认为这可能是角度,角度动画和角度消息之间的版本问题,它们必须在相同的版本才能兼容.

Bower包列表 - bower.json:

  "dependencies": {
    "ng-cordova-oauth": "^0.2.6",
    "angular": "~1.6.4",
    "angular-animate": "~1.6.4",
    "angular-messages": "~1.6.4"
  }
Run Code Online (Sandbox Code Playgroud)

但没有..仍然得到同样的错误.还有什么呢?有任何想法吗?

谢谢

angularjs ionic-framework ng-messages

3
推荐指数
2
解决办法
6635
查看次数

Firebase 实时数据库 - 查找和更新

我正在测试 firebase 的实时数据库,但我真的很难过。首先,我想知道查找记录并使用其他信息更新它的最佳方法是什么。假设我有一个用户并且有一个发布请求,我想更改其名称。

我试过:

var userRef = admin.database().ref('users');
var email = req.body.email;
var name = req.body.name;
userRef.equalTo(email).update({name: name});
Run Code Online (Sandbox Code Playgroud)

尝试遵循官方文档,但没有运气。

我的数据库:

users
   -Lbq98URniAej2TkWBhG
      email: "pepe@san.com"
      name: "Pepe"
-Lbq9GC1A131De-iumI0
      email: "pipa@boca.com"
      name: "Pipa"
Run Code Online (Sandbox Code Playgroud)

另外,请注意我事先不知道 uid,所以我必须查看子数据。

javascript firebase firebase-realtime-database

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

如何通过浏览器尝试 Google Places API?

所以我想在将 API Google Places 放入我的代码之前尝试一下...想先检查一下这是否是我所需要的。

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=cruise&key=AddYourOwnKeyHere

所以这是我试图测试的链接,我正在使用我从控制台创建的自己的密钥。我遵循了所有步骤,但仍然收到错误“REQUEST_DENIED”。

步骤: - 创建我的项目。- 选择 Google Places Web Service Api 并启用它。-转到凭据,新的 API 密钥 -浏览器密钥类型 -得到它。

有什么线索吗?

api google-maps

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

NodeJS - 通过Id找不到工作

我刚刚开始使用NodeJs,我接受了一些教程,但在我尝试自己完成之后,我正在努力解决一些问题.

我正在尝试编辑保存到我的Mlab(Mongo)数据库中的帖子.但即使我有一个很好的回应,我也无法达到我的价值观:

我的server.js代码

 app.get('/post/:id/edit', function(req,res){
  console.log(req.params.id)
  db.collection('posts').find({_id:ObjectId(req.params.id)},{},{}, function(err, result){
    console.log(result)
    if (err) return console.log(err)
      res.render('edit.ejs', {post: result})
  })
})
Run Code Online (Sandbox Code Playgroud)

结果我得到以下内容:(没有预期的文字或标题)

Readable {
  pool: null,
  server: null,
  disconnectHandler:
   { s: { storedOps: [], storeOptions: [Object], topology: [Object] },
     length: [Getter] },
  bson: {},
  ns: 'analistafuncionalblog.posts',
  cmd:
   { find: 'analistafuncionalblog.posts',
     limit: 0,
     skip: 0,
     query: { _id: 5921bf9aff2e7524b4552480 },
     readPreference: { preference: 'primary', tags: undefined, options: [Object] },
     slaveOk: true,
     fields: {} },
  options:
   { readPreference: { preference: 'primary', tags: undefined, options: …
Run Code Online (Sandbox Code Playgroud)

mongodb node.js

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

throw new TypeError('app.use() 需要中间件函数') - 表达应用程序错误

我找不到问题出在哪里,nodejs 控制台也没有说太多。

错误:

TypeError: app.use() 需要 EventEmitter.use (C:\Users\Ezequiel\Desktop\mobile_standard\server\StandardServer\node_modules\express\lib\application.js:210:11) 中对象的中间件函数。(C:\Users\Ezequiel\Desktop\mobile_standard\server\StandardServer\app.js:21:5) 在 Module._compile (module.js:409:26) 在 Object.Module._extensions..js (module.js) :416:10) 在 Module.load (module.js:343:32) 在 Function.Module._load (module.js:300:12) 在 Function.Module.runMain (module.js:441:10) 启动时(node.js:139:18)在node.js:968:3

app.js(第 21 行 -> app.use(require('./controllers/login'));)

const express = require('express');
const cors = require('cors');
const bodyParser= require('body-parser');
const MongoClient = require('mongodb').MongoClient
const mongoose = require('mongoose');
const jwt = require('jsonwebtoken'); 
const app = express();

var config = require('./config'); 
var User = require("./models/user"); 

app.use(cors());
app.options('*', cors());
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());

mongoose.connect(config.database); 
app.set('superSecret', config.secret);

app.use(require('./middlewares/auth'));
app.use(require('./controllers/login'));    

app.get('/normal', function(req,res){
    res.json({ …
Run Code Online (Sandbox Code Playgroud)

node.js express

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

云函数 - CORS - 无法读取未定义的属性“来源”

我正在尝试将 cors 设置到我的项目中,但安装包后,在尝试部署到 Firebase 后出现错误。

错误

Error: Error occurred while parsing your function triggers.
TypeError: Cannot read property 'origin' of undefined
Run Code Online (Sandbox Code Playgroud)

我的代码-index.js

const cors = require('cors')({
  origin: true
});
Run Code Online (Sandbox Code Playgroud)

套餐

"dependencies": {
    "firebase-admin": "~7.0.0",
    "firebase-functions": "^2.2.0",
    "express": "*",
    "cors": "*"
  },
Run Code Online (Sandbox Code Playgroud)

cors firebase google-cloud-functions

0
推荐指数
1
解决办法
5757
查看次数