Project

General

Profile

Actions

Bug #15975

closed

subnets/_fields partial depends on @subnet instance variable

Added by Dominic Cleal over 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
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 1 (0 open1 closed)

Related to Foreman - Feature #14666: Add IPv6 to UIClosedTimo Goebel04/15/2016Actions
Actions #1

Updated by Dominic Cleal over 8 years ago

Actions #2

Updated by The Foreman Bot over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

  • Translation missing: en.field_release set to 160
Actions #4

Updated by Dominic Cleal over 8 years ago

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

Also available in: Atom PDF