From: Jan Provaznik <jprovazn(a)redhat.com>
When instance or hwp with id >9 was fetched, wrong id was used (only first
number of ID was used because of calling 'first' on String object instead on
Array.
---
.../admin/hardware_profiles_controller.rb | 4 ++--
.../controllers/resources/instances_controller.rb | 2 +-
src/app/views/resources/instances/_properties.haml | 3 +++
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/app/controllers/admin/hardware_profiles_controller.rb
b/src/app/controllers/admin/hardware_profiles_controller.rb
index 4ce9ccb..dcd9b67 100644
--- a/src/app/controllers/admin/hardware_profiles_controller.rb
+++ b/src/app/controllers/admin/hardware_profiles_controller.rb
@@ -22,7 +22,7 @@ class Admin::HardwareProfilesController < ApplicationController
end
def show
- @hardware_profile = HardwareProfile.find((params[:id] || []).first)
+ @hardware_profile = HardwareProfile.find(params[:id].to_a.first)
@tab_captions = ['Properties', 'History', 'Matching Provider
Hardware Profiles']
@details_tab = params[:details_tab].blank? ? 'properties' :
params[:details_tab]
case @details_tab
@@ -218,4 +218,4 @@ class Admin::HardwareProfilesController < ApplicationController
hardwareProfileProperty
end
-end
\ No newline at end of file
+end
diff --git a/src/app/controllers/resources/instances_controller.rb
b/src/app/controllers/resources/instances_controller.rb
index d1be6a5..910c2c1 100644
--- a/src/app/controllers/resources/instances_controller.rb
+++ b/src/app/controllers/resources/instances_controller.rb
@@ -163,7 +163,7 @@ class Resources::InstancesController < ApplicationController
private
def load_instance
- @instance = Instance.find((params[:id] || []).first)
+ @instance = Instance.find(params[:id].to_a.first)
require_privilege(Privilege::USE,@instance)
end
diff --git a/src/app/views/resources/instances/_properties.haml
b/src/app/views/resources/instances/_properties.haml
index 5283e20..ebf7cc4 100644
--- a/src/app/views/resources/instances/_properties.haml
+++ b/src/app/views/resources/instances/_properties.haml
@@ -1,3 +1,6 @@
+%h3
+ Properties for
+ = @instance.name
%ul
%li
= label_tag :name, 'Name'
--
1.7.3.5