Confused about 'respond_to' vs 'respond_to?'

后端 未结 3 749
别那么骄傲
别那么骄傲 2021-01-30 02:09

I am learning Rails with railstutorial.org, and I am confused about something: in this chapter the author tells us to do some testing in the console with the respond_to?

3条回答
  •  旧时难觅i
    2021-01-30 02:56

    respond_to? is a Boolean evaluation. The respond_to is used (normally) for determining the display information. More information here. The respond_to? checks to see if a method exists and returns true if it does and false if it doesn't.

提交回复
热议问题