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

BaseModel includes ActiveModel::AttributeAssignment #453

Conversation

wayne5540
Copy link
Contributor

@wayne5540 wayne5540 commented Jan 8, 2019

Changes

Add following functions by including ActiveModel::AttributeAssignment:

  • Quickbooks::Model::BaseModel#assign_attributes (Added test)
  • Quickbooks::Model::BaseModel#attributes= (No test)

Notes

  • Added a assign_attributes test case, it's duplicated with ActiveModel's test but I think it's ok to duplicate it so we can make sure it works on this gem.
  • While working on this gem, I found the rspec dependency is still 2.14.1 which is relatively old compare to current version 3.8.0, this bothered me because I was trying to use aggregate_failures function to test getters from #assign_attributes separately so there won't be dependency with #attributes test, are you considering update rspec to current version in the future? Happy to help with it as well.

Reference

@wayne5540
Copy link
Contributor Author

wayne5540 commented Jan 8, 2019

Test breaks because ActiveSupport requires Ruby > 2.2.2. Not caused by this PR.

@drewish
Copy link
Contributor

drewish commented Dec 6, 2019

Might be worth rebasing this PR against master to see if the tests will be happier with all the gem bumps that have happened since then.

To provide following functions:

* assign_attributes
* attributes=
@wayne5540 wayne5540 force-pushed the wayne-add-activemodel-attribute-assignment branch from 60da251 to f09fc3a Compare December 6, 2019 19:10
@wayne5540
Copy link
Contributor Author

wayne5540 commented Dec 6, 2019

Rebased. CI still failed. Found reason.

This PR failed the test with Ruby < 2.3 because ActiveModel::AttributeAssignment was introduced by rails 5+. reference

Run the CI with Ruby verison < 2.3 will use activemode 4.2.11 version which has not yet implemented ActiveModel::AttributeAssignment module.

To make this PR works we need to lock dependency to activemodel > 5.0 which I don't know if it worth.

@ruckus
Copy link
Owner

ruckus commented Dec 6, 2019

Thanks for investigating @wayne5540

No we definitely cannot lock to > 5.0. I'm still on 4.x (just upgraded my massive legacy app from rails3 last week!)

@wayne5540
Copy link
Contributor Author

@ruckus Yes, agree! Feel free to close this PR.

@ruckus
Copy link
Owner

ruckus commented Dec 6, 2019

Closing for now. This PR requires activemodel > 5.0

@ruckus ruckus closed this Dec 6, 2019
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.

3 participants