我nside一个html.erb,我想使用记录器
<script type="text/javascript">
$j(function(){
$j('#AddQuestion').click(function(){
//Send and http transaction to the server to get the address
$j('#dialog').dialog(
{buttons:{OK:function (event) {
say('You clicked the ' + $(event.target).text() + ' button' );
}, No:function (event) {
say('You clicked the ' + $(event.target).text() + ' button' );
}
}
});
$j('#dialog').dialog('open');
});
});
</script>
Run Code Online (Sandbox Code Playgroud) 如何在Rails中执行以下更新查询?我想在数据库中使用单个更新查询执行此操作.在伪代码中,我会写:
update answers set user_id = @user.id where answered_by=@user.email and user_id = 0
Run Code Online (Sandbox Code Playgroud)
在SQL中它可能是这样的:
UPDATE `answers` SET user_id = '123' WHERE answered_by = 'email@example.com' and user_id = 0
Run Code Online (Sandbox Code Playgroud)