Sha256: f1d8330cac22a5c87a7100b0eb3b13282593598709e68a44a7b322a10e071de3

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

  # DELETE /<%= plural_name %>/1
  <%- if xml? -%>
  # DELETE /<%= plural_name %>/1.xml
  <%- end -%>
  def destroy
    @<%= singular_name %> = <%= class_name %>.find(params[:id])

    <%- if xml? -%>
    respond_to do |format|
      if @<%= singular_name %>.destroy
        set_flash
        format.html { redirect_to <%= plural_name %>_url }
        format.xml  { head :ok }
      else
        set_flash :error, :failed
        format.html { redirect_to :back }
        format.xml  { head :ok }
      end
    end
    <%- else -%>
    if @<%= singular_name %>.destroy
      set_flash
      redirect_to <%= plural_name %>_url
    else
      set_flash :error, :failed
      redirect_to :back
    end
    <%- end -%>
  end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iain-pizza-generators-0.1.4 rails_generators/pizza_scaffold/templates/actions/destroy.rb