1
2
3
4
5
6
7
8
9
10
  def update
    @widget = Widget.find(params[:id])
    redirect_to :action => 'index' and return unless @widget.editable_by?(current_user)
    
    if @widget.update_attributes(params[:widget])
      redirect_to :action => 'edit', :id => @widget
    else
      render :action => 'edit'
    end
  end