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

#303 optional add default to changes #304

Merged

Conversation

senid231
Copy link
Member

@senid231 senid231 commented Oct 3, 2018

class Account < JsonApiClient::Resource
  property :name
  property :is_active, default: true
  property :balance
end

class User < JsonApiClient::Resource
  self.add_defaults_to_changes = true
  property :name
  property :is_active, default: true
  property :balance
end

account = Account.new
account.changed # []

user = User.new
user.changed # ['is_active']

add optional behavior when default values will be added to payload
related to #303

Copy link
Collaborator

@gaorlov gaorlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@senid231 senid231 merged commit dbdb0f6 into JsonApiClient:master Oct 4, 2018
@senid231 senid231 mentioned this pull request Oct 5, 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.

2 participants