You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CodeMeister edited this page Feb 28, 2023
·
1 revision
predicate methods:
Predicate methods, those that end with a question mark, will always return
true or false. They will never return any other value or raise any exceptions.
post.draft?#=> truepost.archived?#=> false
getter methods:
Getter methods, those that expect a value to be returned, will always return
a 'truthy' value such as a String, Symbol, Array or Hash, as specified
in the documentation above. They will never return nil, false nor
raise any exceptions.
Setter methods, those that make changes, will always return
the expected ActiveRecord response if successfull. If the new state is invalid
or the transition is not allowed, an ArgumentError exception will be raised.
Note: the exception is raised even if the change is not being persisted to
the database.