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

Refactor attributes #50

Merged
merged 12 commits into from
Feb 21, 2017
Merged

Refactor attributes #50

merged 12 commits into from
Feb 21, 2017

Conversation

brianstien
Copy link
Collaborator

  • Updates our attribute_assignment module (previously mass_assignment) to mirror rails 5, and also enforce strong params
  • Removed attribute defaults, along with their performance issue of calling all public getters on initialization
  • Eliminated need for chainable initialization and block initialization is baked in

This brings active_remote in line with rails 4-5.

ActiveRemote will now enforce strong params.
Chainable initialization is not necessary now that nothing is
overridding initialize.

Block initialization functionality is moved into the base initialize
method and this will always be enabled, no longer optional.
All codepaths should now be setting this up when we need it.  The
allocate method will not set up an attributes hash but all the internals
using allocate have been made tolerant of this.  Anyone manually calling
allocate should understand what they are doing.
The ActiveModel implementation of this method is very slow because
ActiveModel does not know about our internal attribute storage
mechanism.  ActiveRecord overrides this method with the implementation
here so that this method is fast.

By implementing this the same as ActiveRecord, we get a nice perf boost.
@liveh2o liveh2o merged commit ab7fba6 into liveh2o:master Feb 21, 2017
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.

2 participants