Skip to content

Bug with leaf? method #66

@marcinwierzbicki

Description

@marcinwierzbicki

leaf? method given me exception:

TypeError: nil can't be coerced into Fixnum
from /usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/associations/collection_association.rb:319:in `+'

I have the same error with this:
model.association.children.size.zero?

Can we change implementation of leaf?


method from:

def leaf?
  children.size.zero?
end

to:

def leaf?
  children.blank?
end

?

Video: https://youtu.be/hutkAa39JcU

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