Sha256: fb7e756cfef9f3cd828bc61ec059bd49ddf3af49a608a37a12d2fba6107627ca
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
<% module_namespacing do -%> class <%= controller_class_name %>Controller < ApplicationController def index @<%= plural_table_name %> = <%= orm_class.all(class_name) %> end def show @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %> end def new @<%= singular_table_name %> = <%= orm_class.build(class_name) %> end def edit @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %> end def create @<%= singular_table_name %> = <%= orm_class.build(class_name, "params[:#{singular_table_name}]") %> if @<%= orm_instance.save %> redirect_to @<%= singular_table_name %>, <%= key_value :notice, "'#{human_name} wurde erstellt.'" %> else render <%= key_value :action, '"new"' %> end end def update @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %> if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %> redirect_to @<%= singular_table_name %>, <%= key_value :notice, "'#{human_name} wurde gespeichert.'" %> else render <%= key_value :action, '"edit"' %> end end def destroy @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %> @<%= orm_instance.destroy %> redirect_to <%= index_helper %>_url, <%= key_value :notice, "'#{human_name} wurde gelöscht.'" %> end end <% end -%>
Version data entries
3 entries across 3 versions & 1 rubygems