首页
\
问答
\
如何在ActiveAdmin 0.5.0中为资源全局指定预先加载?(How to specify eager loading globally for a resource in ActiveAdmin 0.5.0?)
如何在ActiveAdmin 0.5.0中为资源全局指定预先加载?(How to specify eager loading globally for a resource in ActiveAdmin 0.5.0?)
我在ActiveAdmin应用程序中向模型注册了一个页面,如下所示:
ActiveAdmin.register Report do menu parent: 'Administration', priority: 2 scope ... scope ... filter ... filter ... end
“报告”模型/资源与其他模型有许多关联。 为某些关联指定预先加载的最佳方法是什么,这些关联也适用于所有范围和过滤器的结果?
I have a page registered to a model in my ActiveAdmin application as follows:
ActiveAdmin.register Report do menu parent: 'Administration', priority: 2 scope ... scope ... filter ... filter ... end
The "Report" model/resource has a number of associations with other models. What is the best way to specify eager loading for some of the associations which also be applied to result of all scopes and filters?
原文:https://stackoverflow.com/questions/29038077
更新时间:2024-05-02 21:05
最满意答案
apply plugin: 'base' ['blue', 'red'].each { colour -> file(colour).listFiles().each { File folder -> if (folder.directory) { Task tarTask = tasks.create(name: "tar${colour.capitalize()}${folder.capitalize()}", type: Tar) { from folder destinationDir = "${buildDir}/${colour}" archiveName = "${folder}.tar" } assemble.dependOn tarTask } } }
apply plugin: 'base' ['blue', 'red'].each { colour -> file(colour).listFiles().each { File folder -> if (folder.directory) { Task tarTask = tasks.create(name: "tar${colour.capitalize()}${folder.capitalize()}", type: Tar) { from folder destinationDir = "${buildDir}/${colour}" archiveName = "${folder}.tar" } assemble.dependOn tarTask } } }
相关问答
更多-
解压tar.gz文件[已关闭](Uncompress tar.gz file [closed])[2021-12-23]
使用-C的tar选项: tar zxvf.tar.gz -C /usr/src/ 然后,焦油的内容应该在: /usr/src/ Use -C option of tar: tar zxvf .tar.gz -C /usr/src/ and then, the content of the tar should be in: /usr/src/ -
尝试删除要排除的目录路径的最后一个/末尾 tar -pczf MyBackup.tar.gz /home/user/public_html/ --exclude "/home/user/public_html/tmp" Try removing the last / at the end of the directory path to exclude tar -pczf MyBackup.tar.gz /home/user/public_html/ --exclude "/home/user/publ ...
-
在深入研究7-zip源代码后,我通过添加“add to tar.gz”项扩展了7-zip上下文菜单。 它的工作原理! After digging into the 7-zip source code, i extended the 7-zip context menu by adding "add to tar.gz" item. and it works !
-
我应该使用.tar.gz吗?(Should I use .tar.gz?)[2023-05-12]
.tar.gz上的“随机”访问权限并不好,因为这是一个以.gz压缩包装的.tar文件,所以要获取.tar文件中的内容,首先必须解压缩.tar文件。 可以使用包含.gz压缩的单个文件的.tar文件。 您可以阅读.tar文件的内容表,查找/存储归档中所有文件的位置,然后根据需要进行提取。 但是,您可能会发现使用您自己的格式是“更好”(例如,如果我没记错的话,tar-archive的“标题”一次只是一个文件,您可能想要一次性构建标题,在存储文件之前[这意味着至少首先枚举所有相关文件,然后形成压缩变体并使用压缩形式 ... -
使用PHP创建.tar.gz文件(Create .tar.gz file using PHP)[2022-06-08]
使用“parent-folder”的父级作为Phar::buildFromDirectory()的基础,并使用其第二个参数将结果限制为“parent-folder”,例如: $parent = dirname("parent-folder"); $pd->buildFromDirectory($parent, '#^'.preg_quote("$parent/parent-folder/", "#").'#'); $pd->compress(Phar::GZ); Use the parent of "pa ... -
使用.NET创建tar.gz(Create tar.gz using .NET)[2022-04-16]
我想你也可以使用http://sevenziplib.codeplex.com/ I guess you can also use http://sevenziplib.codeplex.com/ -
我试着这样回答: cd "$a" for f in $b'_*.gz' do tar cf $a/$b'.tar' $f done I try this way and answer : cd "$a" for f in $b'_*.gz' do tar cf $a/$b'.tar' $f done
-
使用Tar Task为Gradle中的每个文件夹创建一个tar.gz(Create a tar.gz for each folder in Gradle with Tar Task)[2023-04-04]
apply plugin: 'base' ['blue', 'red'].each { colour -> file(colour).listFiles().each { File folder -> if (folder.directory) { Task tarTask = tasks.create(name: "tar${colour.capitalize()}${folder.capitalize()}", type: Tar) { ... -
没有find : for dir in */; do tar -czvf "${dir%/}".tar.gz "$dir"; done 其中*/确保glob只匹配目录, "${dir%/}"从目录名中删除尾部斜杠。 如果有隐藏目录,则它们与/*不匹配; 我也可以使用shopt -s dotglob 。 Without find: for dir in */; do tar -czvf "${dir%/}".tar.gz "$dir"; done where */ makes sure that the ...
-
正如mouviciel在评论中所说, tar默认在当前工作目录中创建文件。 只需在tar.gz文件前加上该文件夹的前缀,它就会在您想要的位置创建它: tar -czvf /tmp/psk1/hadoop_validation$ENV/${folder_name}.tar.gz /tmp/psk1/hadoop_validation$ENV/${folder_name} 请注意,因为您将在归档的同一文件夹中创建tar,所以file changed as we read it作为输出的一部分file chan ...