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

Documentation wrong for callbacks? #171

Open
travisp opened this issue Apr 3, 2012 · 3 comments
Open

Documentation wrong for callbacks? #171

travisp opened this issue Apr 3, 2012 · 3 comments
Assignees
Milestone

Comments

@travisp
Copy link

travisp commented Apr 3, 2012

According to the readme and rdocs, in the below callback, self is the record, and transition is the argument for the do block. But when I run the code, self appears to be the transition, while the argument for the do block is the record. Has something changed and the documentation failed to keep up?

    after_transition any => :processing do |transition|
        self.process_image
    end
@markquezada
Copy link

The behavior of the callbacks depends on the integration you're using. Some bind self, some pass in both the object and the transition as arguments to the block.

Look here for more info:

http://rdoc.info/github/pluginaweek/state_machine/master/StateMachine/Callback#bind_to_object-class_method

@obrie
Copy link
Member

obrie commented Apr 12, 2012

I'll be making some updates to support self for ActiveRecord 3.1+, but in general the behavior of self matches the behavior in the callbacks for the ORM you're using. Stay tuned :)

@ghost ghost assigned obrie Apr 23, 2012
@njakobsen
Copy link

Got bitten by this too. It would be great if it was the same in all ORMs, but I should have read the documentation more carefully.

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

No branches or pull requests

4 participants