我怎样才能避免打字
TypeOfVoyagePortActivity.find_by_description(activity_description)
两次?
这是我在其中使用它的上下文:
if TypeOfVoyagePortActivity.find_by_description(activity_description)
pl.activity = TypeOfVoyagePortActivity.find_by_description(activity_description)
else
pl.activity = TypeOfVoyagePortActivity.find_by_description("Custom")
end