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

Run action controller load hook only once #282

Merged
merged 1 commit into from
Nov 3, 2017
Merged

Conversation

redtachyons
Copy link

Rails execute action_controller onload hooks for Both ActionController::Base and ActionController::API.

Rails introduced has_one option to limit executions to one

This will fix #173 for rails 5.1.4 and above

@tute
Copy link
Member

tute commented Nov 3, 2017

Wonderful, thank you! 😃

Would you please include the context in the PR description as part of the commit message? After that, will merge on green CI. Yay!! 🎉

@redtachyons
Copy link
Author

Will try, my English is poor

@tute
Copy link
Member

tute commented Nov 3, 2017

Current PR description is good enough! :-)

@tute
Copy link
Member

tute commented Nov 3, 2017

Rails 5.1 seems to fail on CI:

/home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/railties-5.1.0/lib/rails/test_unit/minitest_plugin.rb:9:in `aggregated_results': wrong number of arguments (given 1, expected 0) (ArgumentError)
	from /home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/minitest-5.10.3/lib/minitest.rb:597:in `report'
	from /home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/minitest-5.10.3/lib/minitest.rb:687:in `each'
	from /home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/minitest-5.10.3/lib/minitest.rb:687:in `report'
	from /home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/minitest-5.10.3/lib/minitest.rb:141:in `run'
	from /home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/railties-5.1.0/lib/rails/test_unit/minitest_plugin.rb:77:in `run'
	from /home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/minitest-5.10.3/lib/minitest.rb:63:in `block in autorun'
rake aborted!
Command failed with status (1): [ruby -w -I"lib:lib:test" -I"/home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/rake-12.2.1/lib" "/home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/rake-12.2.1/lib/rake/rake_test_loader.rb" "test/integration/navigation_test.rb" "test/unit/action_test.rb" "test/unit/base_target_finder_test.rb" "test/unit/merit_unit_test.rb" "test/unit/rule_unit_test.rb" "test/unit/rules_matcher_test.rb" "test/unit/sash_finder_test.rb" "test/unit/sash_test.rb" "test/unit/score_test.rb" "test/unit/target_finder_test.rb" ]
/home/travis/build/merit-gem/merit/vendor/bundle/ruby/2.3.0/gems/rake-12.2.1/exe/rake:27:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/cli/exec.rb:75:in `load'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/cli/exec.rb:75:in `kernel_load'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/cli/exec.rb:28:in `run'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/cli.rb:424:in `exec'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/cli.rb:27:in `dispatch'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/cli.rb:18:in `start'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/exe/bundle:30:in `block in <top (required)>'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
/home/travis/.rvm/gems/ruby-2.3.3@global/gems/bundler-1.16.0/exe/bundle:22:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.3.3@global/bin/bundle:23:in `load'
/home/travis/.rvm/gems/ruby-2.3.3@global/bin/bundle:23:in `<main>'
/home/travis/.rvm/gems/ruby-2.3.3@global/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.3.3@global/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)
The command "bundle exec rake" exited with 1.
cache.2
store build cache
$ bundle clean
0.01s
6.31schanges detected, packing new archive
sh: 1: sw_vers: not found
Done. Your build exited with 1.```

@redtachyons
Copy link
Author

Ok, let me check

@redtachyons
Copy link
Author

Build failure in 5.1 is unrelated and is a rails bug. build is failing in master as well rails/rails#29022

Rails execute `action_controller` onload hooks for Both ActionController::Base and ActionController::API.

Rails [introduced](rails/rails#30045) `has_one` option to limit executions to one

This will fix merit-gem#173 for rails 5.1.4 and above
@redtachyons
Copy link
Author

@tute tests are now 💚

@tute tute merged commit 5d7ed51 into merit-gem:master Nov 3, 2017
@tute
Copy link
Member

tute commented Nov 3, 2017

Thank you so much! 👏 🎉 ❤️ 😃

@redtachyons redtachyons deleted the patch-1 branch November 3, 2017 20:09
@tachyons tachyons mentioned this pull request Nov 4, 2017
@yakschuss
Copy link
Contributor

yakschuss commented Nov 22, 2017

Hey @tute @tachyons - I just updated to 3.0.0 and when I upgraded to rails-5.0.0, this issue still persisted. Any ideas what I can do? I can open a new issue, but felt that this was related.

@tachyons
Copy link
Contributor

This fix is for newer version of rails ( rails 5.14 and above) . And fix is not available in released gem yet

@yakschuss
Copy link
Contributor

OK, I will wait! Thanks :)

@jairovm
Copy link
Contributor

jairovm commented Jan 22, 2018

Hi guys, are you planning on doing a release to get this fix soon ?

3.0.1 maybe.

Thanks

@tute
Copy link
Member

tute commented Jan 24, 2018

I'd like to get #279 in before a new release. Anyone willing to wrap up the work started in that PR? Thank you, all! :-)

@redtachyons
Copy link
Author

@tute done

@tute
Copy link
Member

tute commented Jan 25, 2018

Thank you, released!

@tute tute mentioned this pull request Nov 27, 2018
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

Successfully merging this pull request may close these issues.

warning: already initialized constant Merit::AppBadgeRules
5 participants