Project

General

Profile

Bug #15975

subnets/_fields partial depends on @subnet instance variable

Added by Dominic Cleal about 4 years ago. Updated about 2 years ago.

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

Description

The subnets/_fields partial has a reference to the @subnet instance variable which makes it harder to reuse the partial in a nested form from a plugin (foreman_setup). Using f.object to refer to the object being rendered is more robust as it doesn't assume how the controller works.

This fixes the following error rendering the form in foreman_setup:

ActionView::Template::Error: undefined method `type' for nil:NilClass
    app/views/subnets/_fields.html.erb:10:in `_app_views_subnets__fields_html_erb__172584428900089411_67260780'
    /var/lib/workspace/workspace/test_plugin_matrix/database/sqlite3/ruby/2.3/slave/fast/plugin/app/views/foreman_setup/provisioners/_step2.html.erb:15:in `block (2 levels) in __var_lib_workspace_workspace_test_plugin_matrix_database_sqlite__ruby_____slave_fast_plugin_app_views_foreman_setup_provisioners__step__html_erb__3389724422021272400_78104880'
    /var/lib/workspace/workspace/test_plugin_matrix/database/sqlite3/ruby/2.3/slave/fast/plugin/app/views/foreman_setup/provisioners/_step2.html.erb:14:in `block in __var_lib_workspace_workspace_test_plugin_matrix_database_sqlite__ruby_____slave_fast_plugin_app_views_foreman_setup_provisioners__step__html_erb__3389724422021272400_78104880'
    app/helpers/form_helper.rb:258:in `form_for'
    /var/lib/workspace/workspace/test_plugin_matrix/database/sqlite3/ruby/2.3/slave/fast/plugin/app/views/foreman_setup/provisioners/_step2.html.erb:2:in `__var_lib_workspace_workspace_test_plugin_matrix_database_sqlite__ruby_____slave_fast_plugin_app_views_foreman_setup_provisioners__step__html_erb__3389724422021272400_78104880'
    /var/lib/workspace/workspace/test_plugin_matrix/database/sqlite3/ruby/2.3/slave/fast/plugin/app/views/foreman_setup/provisioners/step2.html.erb:3:in `__var_lib_workspace_workspace_test_plugin_matrix_database_sqlite__ruby_____slave_fast_plugin_app_views_foreman_setup_provisioners_step__html_erb__4171811634289270913_70611380'
    app/controllers/concerns/application_shared.rb:14:in `set_timezone'
    app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
    /var/lib/workspace/workspace/test_plugin_matrix/database/sqlite3/ruby/2.3/slave/fast/plugin/test/functional/foreman_setup/provisioners_controller_test.rb:53:in `block in <class:ProvisionersControllerTest>' (ActionView::Template::Error)
/var/lib/workspace/workspace/test_plugin_matrix/database/sqlite3/ruby/2.3/slave/fast/foreman/app/views/subnets/_fields.html.erb:10 

Related issues

Related to Foreman - Feature #14666: Add IPv6 to UIClosed2016-04-15

Associated revisions

Revision a152c24d (diff)
Added by Dominic Cleal about 4 years ago

fixes #15975 - replace instance variable ref in subnet partial

History

#1 Updated by Dominic Cleal about 4 years ago

#2 Updated by The Foreman Bot about 4 years ago

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

#3 Updated by Dominic Cleal about 4 years ago

  • Legacy Backlogs Release (now unused) set to 160

#4 Updated by Dominic Cleal about 4 years ago

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

Also available in: Atom PDF