From faa5e6bc10b6d9fbcaa7be9a80543ed893c19978 Mon Sep 17 00:00:00 2001 From: Leandro Segovia Date: Fri, 19 Nov 2021 14:41:20 -0300 Subject: [PATCH 1/2] fix(tag-builder): generating wrong path with nested resources --- CHANGELOG.md | 1 + lib/activeadmin_addons/addons/tag_builder.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39632b2c..32035558 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). * Nested select: get association class from reflect_on_association AR method [#369](https://github.com/platanus/activeadmin_addons/pull/368) * Datepicker options not overriding default options properly [#368](https://github.com/platanus/activeadmin_addons/pull/368) * Invalid default datepicker type for pure Formtastic forms [#367](https://github.com/platanus/activeadmin_addons/pull/367) +* Tag builder generating wrong path with nested resources. ### 1.8.3 diff --git a/lib/activeadmin_addons/addons/tag_builder.rb b/lib/activeadmin_addons/addons/tag_builder.rb index bc9977b2..ab6276be 100644 --- a/lib/activeadmin_addons/addons/tag_builder.rb +++ b/lib/activeadmin_addons/addons/tag_builder.rb @@ -45,7 +45,7 @@ def interactive_params(klass) 'data-model' => class_name, 'data-object_id' => model.id, 'data-field' => attribute, - 'data-url' => context.resource_path(model), + 'data-url' => resource_url, 'data-value' => data } end From d0f8c2bbb9fcdc92f02254b1fa95f45e9b591704 Mon Sep 17 00:00:00 2001 From: Leandro Segovia Date: Wed, 24 Nov 2021 19:13:40 -0300 Subject: [PATCH 2/2] docs(README): improve bool interactive explanation --- docs/enum_integration.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/enum_integration.md b/docs/enum_integration.md index 880eb7f7..c8940ec6 100644 --- a/docs/enum_integration.md +++ b/docs/enum_integration.md @@ -61,3 +61,28 @@ end ``` + +### Important + +If you have: + +```ruby +ActiveAdmin.register Invoice do + index do + tag_column :state, interactive: true + end +end +``` + +By using the toggle button, you'll make a request to `PATCH /admin/invoices/:id`. Because of this, you will need to have the show and update actions activated on `admin/invoices.rb`. + +```ruby +ActiveAdmin.register Invoice do + actions :show, :update # if you remove this line, all CRUD actions will be enabled. So, don't do something like this: `actions :index` or the interactive feature won't work. + + index do + tag_column :state, interactive: true + end +end +``` +