小编Tod*_*all的帖子

PostgreSQL命名约定

我在哪里可以找到有关PostgreSQL命名约定的详细手册?(表名与驼峰案例,序列,主键,约束,索引等......)

postgresql naming-conventions

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

Ruby on Rails将_paginate一个数组

我想知道是否有人可以解释如何在一个对象数组上使用will_paginate

例如,在我的网站上,我有一个意见部分,用户可以对意见进行评分.这是我写的一个方法来收集评价意见的用户:

def agree_list
  list = OpinionRating.find_all_by_opinion_id(params[:id])
  @agree_list = []
  list.each do |r|
    user = Profile.find(r.profile_id)
    @agree_list << user
  end
end
Run Code Online (Sandbox Code Playgroud)

谢谢

pagination ruby-on-rails will-paginate

71
推荐指数
2
解决办法
5万
查看次数

'this'在jQuery自定义方法中未定义

我有一个方法,我想采取一些行动取决于复选框的'已检查'状态.'click'事件按预期工作,但foreach循环中的'myFunction'调用不会:

$(document).ready(function(){
  $('#TreeView1 :checkbox')
    .click(HandleCheckbox); // Works fine

  // Go through the entire Category treeview to 
  // see if there are any checkboxes that are already
  // checked.
  $.fn.myFunction = HandleCheckbox;
  $(":checked:checkbox").each(function(index) {
    // In the HandleCheckbox 'this' is undefined.
    $(this).myFunction(); 
  });

});

function HandleCheckbox() {
  alert(this.name + '=' + this.checked);
}
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,当'.click'方法触发时,'this'被定义为,如预期的那样.当我在foreach循环中调用'muFunction'时,'this'在'HandleCheckbox'函数中未定义.

我仍在学习jQuery绳索,所以如果有更好或更简单的方法,请告诉我.

谢谢.

jquery

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