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

Explicitly define :_default_attribute_values using class_attribute in child class #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

k-tsuchiya-jp
Copy link

Detail

Fix #100

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

@k-tsuchiya-jp
Copy link
Author

before

$ BUNDLE_GEMFILE=/home/zenet/default_value_for/gemfiles/rails_80.gemfile bundle exec rake
/home/k-tsuchiya-jp/.rbenv/versions/3.3.6/bin/ruby test.rb

Testing with ruby version 3.3.6

Testing with Active Record version 8.0.1

Testing with Action Pack version 8.0.1

Run options: --seed 21384

# Running:

...................................F..

Finished in 0.207456s, 183.1710 runs/s, 265.1159 assertions/s.

  1) Failure:
DefaultValuePluginTest#test_multiple_default_values_in_subclass_with_default_values_in_parent_class [test.rb:236]:
Expected: 5678
  Actual: nil

38 runs, 55 assertions, 1 failures, 0 errors, 0 skips
rake aborted!

after

$ BUNDLE_GEMFILE=/home/zenet/default_value_for/gemfiles/rails_80.gemfile bundle exec rake
/home/k-tsuchiya-jp/.rbenv/versions/3.3.6/bin/ruby test.rb

Testing with ruby version 3.3.6

Testing with Active Record version 8.0.1

Testing with Action Pack version 8.0.1

Run options: --seed 45765

# Running:

......................................

Finished in 0.200715s, 189.3235 runs/s, 279.0031 assertions/s.

38 runs, 56 assertions, 0 failures, 0 errors, 0 skips

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.

There are cases where default value is not set in STI since Rails 8.0.1
1 participant