Skip to content

tryの是非 #73

@kzytateishi

Description

@kzytateishi
class Hoge < ActiveRecord::Base
  has_many :aaa
end
@hoge.try(:aaa).try(:bbb)

・仕様変更でaaaがcccに変わったときに

class Hoge < ActiveRecord::Base
  has_many :ccc
end

・tryで握り潰されてしまっているのでエラーが出ない。

@hoge.try(:aaa).try(:bbb)

tryは使わない方がいい...?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions