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

Remove Arity check that does not work with ActiveRecord objects #257

Merged
merged 1 commit into from
Jun 2, 2019

Conversation

MichaelDowse
Copy link
Contributor

@MichaelDowse MichaelDowse commented Mar 27, 2019

The save method a standard ActiveRecord object has an Arity of -1, not 1 as expected by this code.

User.first.method(:save).arity
> -1

The effect is that when we pass in a validation context it is not used.

Removing the check means that it works by default for ActiveRecord objects which is the main use of Wicked, and the only known use of the context option.

The save method a standard ActiveRecord object has an Arity of -1, not 1 as expected by this code.

```
User.first.method(:save).arity
> -1
```

The effect is that when we pass in a validation context it is not used.
@tom-bell-softwire
Copy link

tom-bell-softwire commented Jun 2, 2019

Is there any chance of getting this merged? Having the validation context work for ActiveRecord objects would be really useful (and is probably the majority of use cases, as @MichaelDowse suggests)!

One minor suggestion: would it be more correct to keep the Arity check, but amend it to resource.method(:save).arity != 0 instead?

@schneems
Copy link
Member

schneems commented Jun 2, 2019

Thanks!

@schneems schneems merged commit 22f65b9 into zombocom:master Jun 2, 2019
@woahdae
Copy link

woahdae commented Aug 30, 2019

Could this be released as a version bump?

@schneems
Copy link
Member

I released 1.3.4

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.

4 participants