我想限制" Promo"的属性。就像我想要展示促销的ID和标题 我的代码是:
def show
if @job.present?
if poster_authorize(@job)
render json: @job, :include => [:tasks, :promo.as_json(only: [:title])], status: 200
else
json_forbidden("Forbidden")
end
else
json_not_found("Job Not Available")
end
end
答案 0 :(得分:0)
尝试:
render json: @job.to_json( include: { [:tasks, promo: { only: [:id, :title]}]}), status: 200
答案 1 :(得分:0)
根据docs,你可以这样做:
#set root folder
$baseFolder = "C:\Rejected"
#get folders inside root
$folders = Get-ChildItem $baseFolder -Directory
#for each folder
foreach($folder in $folders) {
#list the files
$files = Get-ChildItem $folder.FullName -File
#if there are files
if($files.Count) {
#build the move destination path
$destination = Join-Path $folder.FullName "Informed"
#move the files
$files | % { Move-Item $_.FullName $destination }
#build an email message with some information + the file listing
$emailMessage = "$($files.Count) files reported and moved in folder $destination"
#this could be formatted, i'm only pushing what you would see
#in the console in the text message
$emailMessage += $files | Out-String
#i.e.: 5 files reported in folder duplicate_found and moved to
#C:\Rejected\duplicate_found\Informed
#
# [file listing]
#send email report for this folder
$emailMessage
}
}