小编mor*_*utt的帖子

Sails.js Production Environment不会在badRequest上返回JSON响应,但是dev环境会返回

如标题中所述,我的sails app对特定路由/控制器函数的GET请求在开发环境中返回带有JSON的badRequest,但不在prod环境中返回.为什么是这样?

这是控制器功能:

    index: function(req, res) {

    async.auto({

        companies: function(cb) {

            User.findOneById(req.session.user.id)
                 .populate('companies')
                 .exec(function(err, user) 
            {

                if(err) {
                    var badRequestData = { error: err };
                    return cb(badRequestData, null);
                } else if(user.companies.length == 0) {
                    var badRequestData = { error: "This user has no associated companies." };
                    return cb(badRequestData, null);
                }

                cb(null, user.companies)

            });

        },

        validateForNullCompanies: ['companies', function(cb, results) {

            var nullCompanies = _.where(results.companies, { stripeAccountId: null });

            if(nullCompanies.length > 0) {
                var badRequestData = { error: "This user needs to …
Run Code Online (Sandbox Code Playgroud)

node.js sails.js

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

通过测试飞行了解iOS崩溃报告

我已经开始通过Test Flight测试我的应用程序,并且我不时收到此错误:_sigtramp + 42.它仅在应用程序启动时发生,目前仅在iOS 6.0上发生.有没有其他人遇到这个或你能帮助我找出出错的地方吗?

测试飞行Stacktrace

iphone stack-trace ios testflight

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

将.find与正则表达式一起使用

无论如何在rails上的ruby中使用regexp进行查询?

regex sqlite ruby-on-rails

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

为什么我的"initiwithframe"变黑?使用initwithframe进行CGRect圆角绘图

这就是它的样子.我想让黑色背景清晰,似乎无法弄明白.

在此输入图像描述

这是loadView:

loadView { 
  CGRect frame = CGRectMake(screenWidth - OFFSET, DEFAULT_PADDING, 140, 40);
  miniC* mcView = [ [ [miniC alloc] initWithFrame:frame] autorelease];
  mcView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
  [[self view] addSubview:mcView]; 
}
Run Code Online (Sandbox Code Playgroud)

这是我在miniC中调用drawRect的地方:

- (void)drawRect:(CGRect)rect {
    CGContextRef context = UIGraphicsGetCurrentContext();

    // Set Background Color & Border Color
    CGColorRef bgColor = [UIColor scrollViewTexturedBackgroundColor].CGColor; 
    CGColorRef borderColor = [UIColor grayColor].CGColor; 

    CGRect Rect = self.bounds;

    // Round Corners
    roundCorners(context, Rect);

    // Fill with bgcolor
    fillBackgroundColor(context, Rect, bgColor);

    // Add 1 px stroke
    CGRect strokeRect = Rect;
    strokeRect.size.height …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ipad ios

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