class Rspec::Generators::ScaffoldGenerator

def example_valid_attributes

def example_valid_attributes
  # Only take the first attribute so this hash does not become unweildy and large in the
  # generated controller spec. It is the responsibility of the user to keep the the valid
  # attributes method up-to-date as they add validations.
  @example_valid_attributes ||=
    if attributes.any?
      { attributes.first.name => attributes.first.default.to_s }
    else
      { }
    end
end