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