Administrate: Rails 6.1.3.2 breaks Administrate

Created on 5 May 2021  路  4Comments  路  Source: thoughtbot/administrate

  • What were you trying to do?

Upgrade to the latest version of Rails

  • What did you end up with (logs, or, even better, example apps are great!)?

An ActionView::Template::Error (see below)

  • What versions are you running?

    • Rails 6.1.3.2

    • administrate 0.15.0

https://github.com/rails/rails/commit/c4c21a9f8d7c9c8ca6570bdb82d64e2dc860e62c requires that things passed to route helpers be symbols and not strings. https://github.com/thoughtbot/administrate/blob/main/app/views/administrate/application/index.html.erb#L44 and L56 break with

     ActionView::Template::Error:
       Please use symbols for polymorphic route arguments.

I'm not sure how prevalent this is within Administrate since I was just testing the simple show case when I tripped on this.

bug

Most helpful comment

I just want to confirm that this issue also affects Rails 6.0.3.7.

All 4 comments

I hate monkey patches with all of my soul, but this monkey patch _seems to be_ (for us) a functioning workaround until a new version of Adminstrate is released:

class Administrate::ResourceResolver
  def namespace
    controller_path.split("/").first.to_sym
  end
end

Thanks for opening this! I'm going to look at #1972 next and see if we need to make any other changes.

@michaelwebb76

I hate monkey patches with all of my soul, but this monkey patch _seems to be_ (for us) a functioning workaround until a new version of Adminstrate is released:

class Administrate::ResourceResolver
 ...

For us, this was not enough. I also have to monkey patch Administrate:Namespace (as in #1972), and in one custom view I have to change the arguments of link_to and add .to_sym (as in #1972).

I just want to confirm that this issue also affects Rails 6.0.3.7.

Was this page helpful?
0 / 5 - 0 ratings