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

Issue 8 status helpers not working properly #12

Merged
merged 3 commits into from
Nov 28, 2014

Conversation

iffyuva
Copy link
Member

@iffyuva iffyuva commented Nov 27, 2014

fixes #8

@iffyuva iffyuva force-pushed the issue-8-status-helpers-not-working-properly branch from d2e70d6 to fc0907d Compare November 27, 2014 11:34
@@ -37,6 +37,7 @@ def prepare_mos_attributes
self.states = HashWithIndifferentAccess.new
self.events = HashWithIndifferentAccess.new

after_initialize :set_initial_states
before_create :set_initial_states
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need before_create callback then? Also, IIRC after_initialize had a performance penalty - thats the reason I probably did not use it.

Copy link
Member Author

Choose a reason for hiding this comment

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

let me checkout how AR initializes columns to default values.

@iffyuva
Copy link
Member Author

iffyuva commented Nov 27, 2014

so, we dont need before_create. modified code so that after_initialize will run only for new records.

gnufied pushed a commit that referenced this pull request Nov 28, 2014
…orking-properly

Issue 8 status helpers not working properly
@gnufied gnufied merged commit 08cd096 into master Nov 28, 2014
@gnufied gnufied deleted the issue-8-status-helpers-not-working-properly branch November 28, 2014 12:02
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.

status helpers provided by ministry of state are not working on non persisted objects
2 participants