Commit c6d67b73c057085f15e1863c356f25b0ebb43c07

Authored by Victor Costa
1 parent a3dea573

api: fix creation of specific article

Showing 1 changed file with 1 additions and 3 deletions   Show diff stats
lib/noosfero/api/helpers.rb
... ... @@ -98,8 +98,6 @@ require_relative '../../find_by_contents'
98 98 end
99 99 end
100 100  
101   - ARTICLE_TYPES = ['Article'] + Article.descendants.map{|a| a.to_s}
102   -
103 101 def find_article(articles, id)
104 102 article = articles.find(id)
105 103 article.display_to?(current_person) ? article : forbidden!
... ... @@ -109,7 +107,7 @@ require_relative '../../find_by_contents'
109 107 return forbidden! unless current_person.can_post_content?(asset)
110 108  
111 109 klass_type = params[:content_type] || params[:article].delete(:type) || TinyMceArticle.name
112   - return forbidden! unless ARTICLE_TYPES.include?(klass_type)
  110 + return forbidden! unless klass_type.constantize <= Article
113 111  
114 112 article = klass_type.constantize.new(params[:article])
115 113 article.last_changed_by = current_person
... ...