Sha256: 83c37a6f1d3e885886a6afc855b07afe20bd5a1c7040ec8987e5e9cff932a961
Contents?: true
Size: 1.39 KB
Versions: 29
Compression:
Stored size: 1.39 KB
Contents
class <%= controller_class_name %>Controller < ApplicationController <% unless suffix -%> def index list render_action 'list' end <% end -%> <% for action in unscaffolded_actions -%> def <%= action %><%= suffix %> end <% end -%> def list<%= suffix %> @<%= singular_name %>_pages, @<%= plural_name %> = paginate :<%= plural_name %>, :per_page => 10 end def show<%= suffix %> @<%= singular_name %> = <%= model_name %>.find(@params['id']) end def new<%= suffix %> @<%= singular_name %> = <%= model_name %>.new(@params["<%= singular_name %>"]) if @request.post? and @<%= singular_name %>.save flash[:notice] = '<%= model_name %> was successfully created.' redirect_to :action => 'list<%= suffix %>' end end def edit<%= suffix %> @<%= singular_name %> = <%= model_name %>.find(@params['id']) @<%= singular_name %>.attributes = @params["<%= singular_name %>"] if @request.post? and @<%= singular_name %>.save flash[:notice] = '<%= model_name %> was successfully updated.' redirect_to :action => 'list<%= suffix %>' end end def destroy<%= suffix %> @<%= singular_name %> = <%= model_name %>.find(@params['id']) if @request.post? @<%= singular_name %>.destroy flash[:notice] = '<%= model_name %> was successfully deleted.' redirect_to :action => 'list<%= suffix %>' end end end
Version data entries
29 entries across 29 versions & 2 rubygems