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

Unknown key: :on. Valid keys are: :if, :unless, :prepend (ArgumentError) #39

Open
deepakmahakale opened this issue Sep 17, 2020 · 0 comments

Comments

@deepakmahakale
Copy link

deepakmahakale commented Sep 17, 2020

Getting the following error while upgrading the application from rails 5.2 to 6.0

Unknown key: :on. Valid keys are: :if, :unless, :prepend (ArgumentError)

Ruby: 2.5.1
Rails: 6.0.3.3

Solution:
Fix here -

before_validation :set_creator_attribute, on: :create, if: :record_userstamp
before_save :set_updater_attribute, if: :record_userstamp
before_save :set_creator_attribute, on: :create, if: :record_userstamp

	28: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/bundler/gems/activerecord-userstamp-8b0a51a84b86/lib/activerecord/userstamp.rb:1:in `<top (required)>'
	27: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require'
	26: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:291:in `load_dependency'
	25: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `block in require'
	24: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require'
	23: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/bundler/gems/activerecord-userstamp-8b0a51a84b86/lib/active_record/userstamp.rb:1:in `<top (required)>'
	22: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/bundler/gems/activerecord-userstamp-8b0a51a84b86/lib/active_record/userstamp.rb:29:in `<module:Userstamp>'
	21: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies/autoload.rb:72:in `eager_load!'
	20: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies/autoload.rb:72:in `each_value'
	19: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies/autoload.rb:72:in `block in eager_load!'
	18: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require'
	17: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:291:in `load_dependency'
	16: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `block in require'
	15: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require'
	14: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/bundler/gems/activerecord-userstamp-8b0a51a84b86/lib/active_record/userstamp/model_additions.rb:8:in `<top (required)>'
	13: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/bundler/gems/activerecord-userstamp-8b0a51a84b86/lib/active_record/userstamp/model_additions.rb:8:in `class_eval'
	12: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/bundler/gems/activerecord-userstamp-8b0a51a84b86/lib/active_record/userstamp/model_additions.rb:9:in `block in <top (required)>'
	11: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/bundler/gems/activerecord-userstamp-8b0a51a84b86/lib/active_record/userstamp/model_additions.rb:9:in `include'
	10: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/concern.rb:119:in `append_features'
	 9: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/concern.rb:119:in `each'
	 8: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/concern.rb:119:in `block in append_features'
	 7: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/concern.rb:119:in `include'
	 6: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/concern.rb:122:in `append_features'
	 5: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/concern.rb:122:in `class_eval'
	 4: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/bundler/gems/activerecord-userstamp-8b0a51a84b86/lib/active_record/userstamp/stampable.rb:17:in `block in <module:Stampable>'
	 3: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activemodel-6.0.3.3/lib/active_model/callbacks.rb:131:in `block in _define_before_model_callback'
	 2: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/core_ext/hash/keys.rb:50:in `assert_valid_keys'
	 1: from /home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/core_ext/hash/keys.rb:50:in `each_key'
/home/deepak/.rvm/gems/ruby-2.5.1@my_project/gems/activesupport-6.0.3.3/lib/active_support/core_ext/hash/keys.rb:52:in `block in assert_valid_keys': Unknown key: :on. Valid keys are: :if, :unless, :prepend (ArgumentError)
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

1 participant