Project

General

Profile

Actions

Refactor #16243

closed

Remove required `options` argument to Host::Managed.new

Added by Dominic Cleal over 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

The second "options" hash argument to a model .new method no longer exists on Rails 5 (due to no protected_attrs support?), so Host::Managed#initialize should handle it being present or not.

The hash isn't used directly by initialize, only Rails. Host::Base already does this using a splat operator.

ArgumentError: wrong number of arguments (given 2, expected 0..1)
    activerecord (5.0.0) lib/active_record/core.rb:312:in `initialize'
    app/models/host/base.rb:82:in `initialize'
    actionpack (5.0.0) lib/action_dispatch/routing/url_for.rb:106:in `initialize'
    app/models/host/managed.rb:47:in `initialize'
    activerecord (5.0.0) lib/active_record/inheritance.rb:65:in `new'
    activerecord (5.0.0) lib/active_record/inheritance.rb:65:in `new'
    app/models/concerns/foreman/sti.rb:22:in `new_with_cast'
    app/models/host.rb:15:in `method_missing'
    factory_girl (4.7.0) lib/factory_girl/decorator/new_constructor.rb:9:in `new'
Actions #1

Updated by The Foreman Bot over 7 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3768 added
Actions #2

Updated by Dominic Cleal over 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #3

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release set to 160
Actions

Also available in: Atom PDF