Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning: method already defined in rails 6.1.4 #12

Open
dannyy83 opened this issue Jul 29, 2021 · 7 comments
Open

warning: method already defined in rails 6.1.4 #12

dannyy83 opened this issue Jul 29, 2021 · 7 comments

Comments

@dannyy83
Copy link

dannyy83 commented Jul 29, 2021

Hi there,

I'm using active_admin-state_machine with rails v6.1.4 and ActiveAdmin v2.9.0

When rails is launched, I get warnings for each state_action block defined in my active admin classes:
Warning: method <state action> already defined in <ActiveAdmin Controller>

@dannyy83 dannyy83 changed the title Warnings thrown in rails 6.1.4 warning: method alaredy defined in rails 6.1.4 Jul 29, 2021
@dannyy83 dannyy83 changed the title warning: method alaredy defined in rails 6.1.4 warning: method already defined in rails 6.1.4 Jul 29, 2021
@macfanatic
Copy link
Owner

Could you by chance provide a stack trace so I can more easily determine what method it's conflicting with?

Thanks!

@dannyy83
Copy link
Author

Unfortunately there is no stack trace, just those warnings to stdout.

@dannyy83
Copy link
Author

dannyy83 commented Jul 29, 2021

To give you a more concrete example:

ActiveAdmin.register Book do
  state_action :review do
  end
end
Warning: method `review` already defined in Admin::BooksController

@dannyy83
Copy link
Author

This post explains the issue:
activeadmin/activeadmin#5316

However, the suggested solution does not work for me since some of my state_actions use :confirm
e.g.

ActiveAdmin.register Book do
  state_action :review, confirm: -> { 'Are you sure?' } do
  end
end

@macfanatic
Copy link
Owner

Thanks for providing more input on the issue, just checking in to see if you've found a work-around since we last spoke?

Otherwise I'll see what I can dig up from the linked issue and rails 6.1 (that we now support, yay with #13).

@dannyy83
Copy link
Author

dannyy83 commented Sep 1, 2021

Hi @macfanatic,

I haven't found a work-around. These are just warnings printed to stderr and everything still works as intended so we are ignoring them for now... However I am afraid that future versions of rails may break.

@macfanatic
Copy link
Owner

Could you clone the repo and see if starting the rails app produces those warnings in the dummy app for you?

I do not see those logged when starting a console nor when running the server. I'm also curious if they are still present on the most recent pre-release of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants