Skip to content

Commit

Permalink
Remove arity check that does not work with ActiveRecord objects
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MichaelDowse committed Mar 27, 2019
1 parent 86a8785 commit 0bf7ebb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/wicked/controller/concerns/render_redirect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def render_wizard(resource = nil, options = {}, params = {})
def process_resource!(resource, options = {})
return unless resource

if options[:context] && resource.method(:save).arity >= 1
if options[:context]
did_save = resource.save(context: options[:context])
else
did_save = resource.save
Expand Down

0 comments on commit 0bf7ebb

Please sign in to comment.