Project

General

Profile

Bug #223

When a host update has errors then the render :edit loses required variables

Added by Paul Kelly about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web Interface
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Scenario
The user is editing a pre-existing host. The user presses update. The record fails validation.

Instead of redirect_to @host we render :action => :edit

The Hostscontroller#edit method sets three variables which are used in the render :action => edit operation. These are not set when rendering from another method.

0001-Fixes-223.patch 0001-Fixes-223.patch 4.13 KB Paul Kelly, 04/28/2010 05:07 PM

Associated revisions

Revision 003ae9a1 (diff)
Added by Ohad Levy about 9 years ago

fixes #223 - When a host update has errors then the render :edit loses required variables

History

#1 Updated by Paul Kelly about 9 years ago

All variables were replaced by their original fully qualified method path from the host object, in the supplied patch file

#2 Updated by Ohad Levy about 9 years ago

this patch doesn't remove the instance varibles which are set (e.g. @environment, @operatingsystem etc)

#3 Updated by Paul Kelly about 9 years ago

I tried sending the patch as an email, Maybe that as the problem. If I run git log -p

diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb
index 6a20117..9630d7d 100644
--- a/app/controllers/hosts_controller.rb
+++ b/app/controllers/hosts_controller.rb
@@ -51,9 +51,6 @@ class HostsController < ApplicationController

   def edit
     @host = Host.find(params[:id])
-    @environment = @host.environment
-    @architecture = @host.architecture
-    @operatingsystem = @host.operatingsystem
   end

#4 Updated by Ohad Levy about 9 years ago

  • Target version set to 0.1-5

what do you think of passing the parameters once redirecting to edit?, e.g.

def edit
  @host = ..
  @environment = params[:environment_id] || @host.environment
  ..

#5 Updated by Ohad Levy about 9 years ago

  • Status changed from Ready For Testing to Assigned
  • Assignee changed from Paul Kelly to Ohad Levy

#6 Updated by Ohad Levy about 9 years ago

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

#7 Updated by Ohad Levy about 9 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF