由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 我写的这段,有什么建议吗?
相关主题
Provide internal reference for Amazon SDE positionsBackground Check
关于INTERVIEW的书,说两句.遍一个自己的地址合法吗?
OPT 问题(change of address) 后续[合集] 天昏地暗~身边很多人都PACKING了(UP DATE)
OPT 问题(change of address) 后续 - 再续一道 JAVA Stack vs Heap 题 (转载)
USCIS关于 h1b文件接受大众反馈的途径billing address改了以前的支票还能用吗?
USCIS phone/email/mailing address! Mark please!Career Cup 那本书谁要?
OPT 申请中, 可能再改地址吗?Help - How to raise H1b transfer question?
刚刚打过电话opt加急OPT HELP!!!!
相关话题的讨论汇总
话题: addresses话题: address话题: email话题: end话题: contact
进入JobHunting版参与讨论
1 (共1页)
i*****r
发帖数: 26
1
有什么地方需要修改的吗?
Given a piece of code, what comments would you have for the author?
# Provides CRUD methods for “Contact” records
# - Name MUST be provided
# - Email Addresses MUST be unique class ContactLogic
我写的如下
def self.create(name, email_addresses, description) contact = Contact.new
contact.name = name
contact.description = description
email_addresses.each do |address|
contact.email_addresses << address
if Contact.where(:email_address => address).present?
raise “Cannot duplicate email addresses”
end
end
contact.save!
return contact
end
def self.update(id, name, email_addresses, description)
contact = Contact.find(id)
contact.name = name
contact.description = description
email_addresses.each do |address|
contact.email_addresses << address
if Contact.where(:email_address => address).present?
if Contact.where(:email_address => address).first.id !=id
raise “Cannot duplicate email addresses”
end
end
end
contact.save!
return contact
end
end
a*******g
发帖数: 1221
2
排下版吧
i*****r
发帖数: 26
3
谢谢提醒,已排版

【在 a*******g 的大作中提到】
: 排下版吧
1 (共1页)
进入JobHunting版参与讨论
相关主题
OPT HELP!!!!USCIS关于 h1b文件接受大众反馈的途径
收集收集提问别人的问题USCIS phone/email/mailing address! Mark please!
问个面试题目OPT 申请中, 可能再改地址吗?
Tomorrow Bloomberg Onsite--- But don't know address刚刚打过电话opt加急
Provide internal reference for Amazon SDE positionsBackground Check
关于INTERVIEW的书,说两句.遍一个自己的地址合法吗?
OPT 问题(change of address) 后续[合集] 天昏地暗~身边很多人都PACKING了(UP DATE)
OPT 问题(change of address) 后续 - 再续一道 JAVA Stack vs Heap 题 (转载)
相关话题的讨论汇总
话题: addresses话题: address话题: email话题: end话题: contact