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

Passing Transition args to callbacks #193

Open
the8472 opened this issue Jun 21, 2012 · 3 comments
Open

Passing Transition args to callbacks #193

the8472 opened this issue Jun 21, 2012 · 3 comments
Assignees
Milestone

Comments

@the8472
Copy link

the8472 commented Jun 21, 2012

To get the perform parameters of Model.some_transition.perform(:a, :b, {:c => :d}) we currently have to do something like

before_transition :on => :some_transition do |model, transition|
  (a,b,opts) = transition.args
  # actual code here
end

It would be nice to make the syntax a bit more compact by passing the perform arguments to the callbacks directly if their arity allows

it should look like this

before_transition :on => :some_transition do |model, transition, a, b, opts|
   # actual code here
end

The same applies to method callbacks instead of procs of course.

@rngtng
Copy link

rngtng commented Jul 12, 2012

yeah, +1

@obrie
Copy link
Member

obrie commented Mar 31, 2013

There are some complexities with around callbacks and some of the ORM integrations for this. I'll think about this as part of the 2.0.0 release.

@mark-ellul
Copy link

removed previous question as I did not see mailing list. Thanks for such a great gem!

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