8000 Conditional field in has_many nested form doesn't work if it's the last field · Issue #1990 · activeadmin/activeadmin · GitHub
[go: up one dir, main page]

Skip to content
Conditional field in has_many nested form doesn't work if it's the last field #1990
Closed
@shekibobo

Description

@shekibobo

I have a model:

class Parent < ActiveRecord::Base
  has_many :children
end

And a form:

form do |f|
  f.inputs do
    f.has_many :children do |child_f|
      child_f.input :name
      child_f.input :_destroy, :as => :boolean, :label => "Remove" unless child_f.object.new_record?
    end
  end
end

When the form is loaded, I get the error:

undefined method `+' for nil:NilClass

However, if that unless line is moved to any other position in the block, no error shows up and everything works just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0