Skip to content

Issue generating annotations when a column comment has newline character  #778

Closed
@tmr08c

Description

@tmr08c

When annotating a model with a column that had a comment that includes a newline character, the annotation will interpolate the newline character and add a non-commented line.

For example:

# schema.rb
  create_table "users", force: :cascade do |t|
    t.string "name", comment: "This is a comment.\nWith two lines!"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

will generate the following annotation:

# user.rb

# == Schema Information
#
# Table name: users
#
#  id                                       :bigint           not null, primary key
#  name(This is a comment.
With two lines!) :string
#  created_at                               :datetime         not null
#  updated_at                               :datetime         not null
#

Commands

$ annotate --models --with-comment

Version

  • annotate version: 3.1.0
  • rails version: 6.0.2.2
  • ruby version: 2.6.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions