Skip to content

tryの是非 #73

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は使わない方がいい...?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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