Sha256: 760e75e0e78cd53ff460947b0b60aad0e8b32c7f1dcac260729c376e2a34a70b

Contents?: true

Size: 694 Bytes

Versions: 3

Compression:

Stored size: 694 Bytes

Contents

  def update
    
    @<%= singular_name %> = @<%= parent_singular_name %>.<%= plural_name %>.find(params[:id])
    respond_to do |wants|
      if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
        wants.html do
          flash[:notice] = "Successfully updated <%= name.humanize.downcase %>."
          redirect_to <%= parent_singular_name %>_<%= plural_name %>_path(@<%= parent_singular_name %>)
        end
        <%- if options[:ajaxify] %>
        wants.js
        <%- end %>
      else
        wants.html { render :action => 'edit' }
        <%- if options[:ajaxify] %>
        wants.js { render :action => 'error' }
        <%- end %>
      end
    end
  end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twilson63-nifty-generators-0.3.6 rails_generators/nifty_nested_scaffold/templates/actions/update.rb
twilson63-nifty-generators-0.3.7 rails_generators/nifty_nested_scaffold/templates/actions/update.rb
twilson63-nifty-generators-0.3.8 rails_generators/nifty_nested_scaffold/templates/actions/update.rb