Sha256: d5564e835e832f5c5fe9ab709bf39fb942a89dc4d7f1b79d91b297fae5705809

Contents?: true

Size: 597 Bytes

Versions: 1

Compression:

Stored size: 597 Bytes

Contents

  # PUT /<%= plural_name %>/1
  # PUT /<%= plural_name %>/1.xml
  def update
    @<%= singular_name %> = <%= class_name %>.find(params[:id])

    respond_to do |format|
      if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
        flash[:notice] = '<%= class_name.titleize %> was successfully updated.'
        format.html { redirect_to(<%= item_path('url') %>) }
        format.xml  { head :ok }
      else
        format.html { render :edit }
        format.xml  { render :xml => @<%= singular_name %>.errors, :status => :unprocessable_entity }
      end
    end
  end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iain-pizza-generators-0.1.3 rails_generators/pizza_scaffold/templates/actions/update.rb