Skip to content

undefined method `gsub' for nil:NilClass #620

@vinibrsl

Description

@vinibrsl

Hi!

First of all, thank you for this really useful gem that is a must in my Rails projects.

I've been messing up with Rails 6, and when I created a new migration/model and tried to annotate the files, it seems something got wrong, as you can see in the error messages below.

Here's my migration file:

class CreateSheep < ActiveRecord::Migration[6.0]
  def change
    create_table :sheep do |t|
      t.string :name
      t.date :date_of_birth
      t.references :address, null: true, foreign_key: true
      t.string :phone_number

      t.timestamps
    end
  end
end

And the model:

class Sheep < ApplicationRecord
  belongs_to :address
end

The migration ran fine, but is it something wrong I'm doing?

Commands

$ bundle exec annotate
#> Unable to annotate app/models/sheep.rb: undefined method `gsub' for nil:NilClass
#> Unable to annotate app/models/sheep.rb: no implicit conversion of nil into Array
#> Model files unchanged.

Version

  • annotate version: tried with branch develop and master
  • rails version: 6.0.0.rc1
  • ruby version: 2.6.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions