how do i check if an object has a particular field?

Which answers the slightly different question: Does the database sitting under this Model contain a column called "complete"?

The OP asked about an object (and in particular and ActiveRecord object), so respond_to? is probably a more apropos answer. ActiveRecord overrides respond_to? so that it is true for attributes which may actually be handled by method_missing when actually called.

Consider if the OP had:
  class Article
    def complete

In that case, Article.column_names.include?("complete") == false
even though"complete") == true


Rob Biedenharn

Wasn't there a recent change to core that may be important here? I
remember reading something about cases where, in 1.2.3, respond_to? would
be false because AR hadn't looked at the table yet, while Edge would
correctly respond true. Or something like that.

Jay Levitt