lib/growi/client/model/growi_attachment.rb in growi-client-0.9.0 vs lib/growi/client/model/growi_attachment.rb in growi-client-1.0.0
- old
+ new
@@ -13,17 +13,16 @@
_id: nil, fileFormat: '', fileName: '', originalName: '', filePath: nil,
creator: nil, page: '', __v: 0, createdAt: '', fileSize: 0, url: ''
}
params = init_params.merge(params.map { |k,v| [k.to_sym, v] }.to_h)
- if (params[:_id] == nil)
- raise ArgumentError.new('Parameters id is required.')
+ if (params[:_id].nil?)
+ raise ArgumentError.new('Parameter _id is required.')
end
GrowiModelFactory.instance.register({
- attachment_creator: Proc.new { |param| param != nil && param.is_a?(String) ? param : GrowiUser.new(param) },
- attachment_createdAt: Proc.new { |date_str|
- date_str != nil && DateTime.parse(date_str) },
+ attachment_creator: Proc.new { |param| !param.nil? && param.is_a?(String) ? param : GrowiUser.new(param) },
+ attachment_createdAt: Proc.new { |date_str| !date_str.nil? && date_str != "" ? DateTime.parse(date_str) : "" },
})
maked_params = {}
params.each do |k,v|
maker = GrowiModelFactory.instance.maker('attachment_' + k.to_s)
maked_params[k] = maker.call(v)