From f426c3045bb396f27d6b87ed17098594e77ca713 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Thu, 24 Apr 2008 21:22:16 +0000 Subject: [PATCH] ActionItem280: adapting new to cope with new interface required by edit template --- app/controllers/my_profile/cms_controller.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 54555fb..676d4d9 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -41,9 +41,11 @@ class CmsController < MyProfileController end def new + # FIXME this method should share some logic wirh edit !!! + # user must choose an article type first - type = params[:type] - if type.blank? + @type = params[:type] + if @type.blank? @article_types = [] ARTICLE_TYPES.each do |type| @article_types.push({ @@ -57,8 +59,8 @@ class CmsController < MyProfileController return end - raise "Invalid article type #{type}" unless ARTICLE_TYPES.map {|item| item.name}.include?(type) - klass = type.constantize + raise "Invalid article type #{@type}" unless ARTICLE_TYPES.map {|item| item.name}.include?(@type) + klass = @type.constantize @article = klass.new(params[:article]) -- libgit2 0.21.2