この Rails コードをきれいにする方法はありますか?
def function
if new_record?
thing
else
thing + yet_another_thing
end
end
ここの繰り返しが苦手なthingので、もっときれいな方法はないかと。
助けてくれてありがとう。
この Rails コードをきれいにする方法はありますか?
def function
if new_record?
thing
else
thing + yet_another_thing
end
end
ここの繰り返しが苦手なthingので、もっときれいな方法はないかと。
助けてくれてありがとう。