Method: Cmtool::NewsController#update

Defined in:
app/controllers/cmtool/news_controller.rb

#updateObject

PUT /news/1 PUT /news/1.xml



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'app/controllers/cmtool/news_controller.rb', line 59

def update
  @news = Cmtool::News.find(params[:id])

  respond_to do |format|
    if @news.update_attributes(params[:news])
      format.html { redirect_to([cmtool, @news], :notice => t('cmtool.action.update.successful', :model => Cmtool::News.model_name.human)) }
      format.xml  { head :ok }
    else
      format.html { render :action => "edit" }
      format.xml  { render :xml => @news.errors, :status => :unprocessable_entity }
    end
  end
end