Sha256: 96c1891f77603e740dd2bced5f2dc624b5a1729c113947ffbc49e209e7267126
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
def create @<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>]) respond_to do |format| if @<%= singular_name %>.save flash[:notice] = t('<%= plural_name %>.create.flash') format.html { redirect_to <%= "#{plural_name}_url" %> } <%- unless options[:no_xml] -%> format.xml { render :xml => @<%= singular_name %>, :status => :created, :location => @<%= singular_name %> } <%- end -%> <%- unless options[:no_json] -%> format.json { render :json => @<%= singular_name %>, :status => :created, :location => @<%= singular_name %> } <%- end -%> else format.html { render :action => "new" } <%- unless options[:no_xml] -%> format.xml { render :xml => @<%= singular_name %>.errors, :status => :unprocessable_entity } <%- end -%> <%- unless options[:no_json] -%> format.json { render :json => @<%= singular_name %>.errors, :status => :unprocessable_entity } <%- end -%> end end end
Version data entries
3 entries across 3 versions & 1 rubygems