Skip to content

[Enhancement] Message for 'dependent: :restrict_with_error' #3223

@airled

Description

@airled

Rails_admin ignores Rails message with key restrict_dependent_destroy (See this)

Example:
Country model:

class Country < ApplicationRecord
  has_many :cities, dependent: :restrict_with_error
end

If you try to destroy country with cities inside irb:

irb(main):001:0> c = Country.first
irb(main):002:0> c.destroy
(1.0ms)  ROLLBACK
irb(main):003:0> c.errors.messages
=> {:base=>["Cannot delete record because dependent cities exist"]}

If we try to delete the country via rails_admin we only got an abstract message:
Country failed to be deleted

Rails_admin should use full error message because an admin have to know what is wrong.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions