]> source.dussan.org Git - redmine.git/commitdiff
Do not check the request http method.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 23 Feb 2012 13:05:10 +0000 (13:05 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 23 Feb 2012 13:05:10 +0000 (13:05 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8941 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/news_controller.rb

index 34d4a13cc43a7e94662470df2f661690e229f59d..3084976102afc0c6f6030c3d94f01711e9f2eca3 100644 (file)
@@ -68,16 +68,14 @@ class NewsController < ApplicationController
 
   def create
     @news = News.new(:project => @project, :author => User.current)
-    if request.post?
-      @news.attributes = params[:news]
-      if @news.save
-        attachments = Attachment.attach_files(@news, params[:attachments])
-        render_attachment_warning_if_needed(@news)
-        flash[:notice] = l(:notice_successful_create)
-        redirect_to :controller => 'news', :action => 'index', :project_id => @project
-      else
-        render :action => 'new'
-      end
+    @news.attributes = params[:news]
+    if @news.save
+      attachments = Attachment.attach_files(@news, params[:attachments])
+      render_attachment_warning_if_needed(@news)
+      flash[:notice] = l(:notice_successful_create)
+      redirect_to :controller => 'news', :action => 'index', :project_id => @project
+    else
+      render :action => 'new'
     end
   end
 
@@ -85,7 +83,7 @@ class NewsController < ApplicationController
   end
 
   def update
-    if request.put? and @news.update_attributes(params[:news])
+    if @news.update_attributes(params[:news])
       attachments = Attachment.attach_files(@news, params[:attachments])
       render_attachment_warning_if_needed(@news)
       flash[:notice] = l(:notice_successful_update)