Skip to content

Commit 4469e04

Browse files
Fix compatibility with Administrate v1.0.0 (#57)
They removed deprecated APIs thoughtbot/administrate#2832. The deprecation recommends these changes as recommended updates. https://github.com/thoughtbot/administrate/pull/1941/changes This appears to also address concerns listed here #48 Co-authored-by: Andrei Bondarev <andrei.bondarev13@gmail.com>
1 parent ba860d4 commit 4469e04

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ ATTRIBUTE_TYPES = {
6363
By default the gem adds the Export button to the partial `views/admin/application/_index_header.html.erb`. But if you have your own Administrate `index` views or override that partial in your application you can add the link manually:
6464

6565
```ruby
66-
link_to('Export', [:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button') if valid_action?(:export)
66+
link_to('Export', [:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)], class: 'button') if existing_action?(resource_class, :export)
6767
```
6868

6969
Example:
@@ -78,13 +78,13 @@ Example:
7878
),
7979
[:new, namespace.to_sym, page.resource_path.to_sym],
8080
class: "button",
81-
) if valid_action?(:new) && show_action?(:new, new_resource) %>
81+
) if existing_action?(resource_class, :new) && authorized_action?(new_resource, :new) %>
8282
8383
<%= link_to(
8484
'Export',
8585
[:export, namespace.to_sym, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)],
8686
class: 'button'
87-
) if valid_action?(:export) %>
87+
) if existing_action?(resource_class, :export) %>
8888
</div>
8989
....
9090
```

app/views/admin/application/_index_header.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
[:export, namespace, page.resource_name.to_s.pluralize.to_sym, sanitized_order_params(page, :id).to_h.merge(format: :csv)],
3131
class: 'button',
3232
target: '_blank'
33-
) if valid_action?(:export) && show_action?(:export, resource_name) %>
33+
) if existing_action?(resource_class, :export) && authorized_action?(resource_name, :export) %>
3434
</div>
3535
</header>

0 commit comments

Comments
 (0)