仍然学习骨干所以忍受我;
我正在尝试将一个带有空白字段的新模型添加到视图中,但我创建的模板有很多
<input value="<%= some_value %>" type="whatever" />
Run Code Online (Sandbox Code Playgroud)
在获取数据时工作得非常好,它填充它并且一切顺利.当我想要创建一个新的(空白)渲染视图时会出现问题,它给了我
Uncaught ReferenceError: some_value is not defined
Run Code Online (Sandbox Code Playgroud)
我可以设置defaults(我已经为一些在db中有默认值的东西),但这意味着用空格键入40多个; 有没有更好的方法来处理这个?
我正在摆弄下划线模板本身,尝试类似<%= if(some_value != undefined){ some_value } %>但似乎有点麻烦.
在.push()向数组附加值时,是否有JavaScript(或甚至是coffeescript)的简写?很像php的$array[] = 'added to array';.
我正在使用MySQL2 Ruby驱动程序 - 但它似乎有点多余必须调用
result.each{ |r| puts r['name'] }
Run Code Online (Sandbox Code Playgroud)
对于返回的单行数据.必须有一种更简单的方法来获取我想要的mysql字段而不必使用该each块?
我正在开发一个包含一些计划任务的程序包 - 是否有注册/发布它们的方式而不会影响已设置计划任务的基本应用程序?
我不想覆盖它,App/Console/Kernel.php因为基础应用程序可能已经拥有它自己的计划任务等.
我有一个相当修改的分页查询使用了许多连接等 - 但由于某种原因,paginator-> counter()永远不会匹配计数查询的结果.
您可以在http://dev.qreer.com/上看到它的运行情况- 通过在LHS导航上选择各种选项,查询输出在下面,并且分页器计数看起来非常随机.
知道我可以开始调试这个吗?
在Jobs Controller中:
$this->paginate = $this->Job->paginateParams($data);
$jobs = $this->paginate('Job');
$this->set(compact('jobs'));
Run Code Online (Sandbox Code Playgroud)
在模型中:
function paginateParams($data = null){
//lots of joins + conditions
return array('contain' => $contain, 'recursive' => 0,'joins' => $joins, 'conditions' => $conditions, 'group' => 'Job.id', 'order' => $order);
}
Run Code Online (Sandbox Code Playgroud)
示例连接(所有连接表和数据表的内部连接):
array(
'table' => 'education_backgrounds',
'alias' => 'EducationBackground',
'type' => 'INNER',
'conditions' => array('EducationBackgroundsJobs.education_background_id = EducationBackground.id'),
),
Run Code Online (Sandbox Code Playgroud)
样品条件:
'EducationBackground.name' => array('Aerospace Engineering');
Run Code Online (Sandbox Code Playgroud) javascript ×2
mysql ×2
backbone.js ×1
cakephp ×1
cakephp-1.3 ×1
coffeescript ×1
laravel ×1
laravel-5 ×1
mysql2 ×1
pagination ×1
php ×1
ruby ×1