我感兴趣是否可以使用对象属性作为update_all方法中的值。
假设我们有关系Article并且它有属性part1和part2。现在我想更新与的值part1相关的所有对象的属性。Articlepart2
Article.update_all(part1: current_object.part2)
Run Code Online (Sandbox Code Playgroud)
我只是current_object用来表示当前更新的对象。
我知道我可以做类似的事情
Article.find_each { |article| article.update(part1: article.part2) }
Run Code Online (Sandbox Code Playgroud)
但我想知道这是否可以通过update_all方法实现。
我正在尝试命名字符串网格中的列(在此灰色行中)。我知道我应该使用这样的东西:
procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.Cells[0,0] := 'Text 1';
StringGrid1.Cells[1,0] := 'Text 2';
end;
Run Code Online (Sandbox Code Playgroud)
问题是有错误:
“TForm1”在第 81 行不包含名为“FormCreate”的成员。
我是初学者。我的程序有什么问题?