<%= @app_name %>.controllers <%= ":#{@pluralized}" %> do get :index do @<%= @pluralized %> = <%= @model %>.all render "<%= @pluralized %>/index" end get :show, :with => :id do @<%= @singular %> = <%= @model %>.find(params[:id]) render "<%= @pluralized %>/show" end <% if @create_full -%> get :new do @<%= @singular %> = <%= @model %>.new render "<%= @pluralized %>/new" end post :create do @<%= @singular %> = <%= @model %>.new(params[:<%= @singular %>]) if @<%= @singular %>.save flash[:notice] = '<%= @model %> was successfully created.' redirect url(:<%= @pluralized %>, :show, :id => @<%= @singular %>.id) else render '<%= @pluralized %>/new' end end get :edit, :with => :id do @<%= @singular %> = <%= @model %>.find(params[:id]) render "<%= @pluralized %>/edit" end put :update, :with => :id do @<%= @singular %> = <%= @model %>.find(params[:id]) if @<%= @singular %>.update_attributes(params[:<%= @singular %>]) flash[:notice] = '<%= @model %> was successfully updated.' redirect url(:<%= @pluralized %>, :show, :id => @<%= @singular %>.id) else render '<%= @pluralized %>/edit' end end delete :destroy, :with => :id do @<%= @singular %> = <%= @model %>.find(params[:id]) if @<%= @singular %>.destroy flash[:notice] = '<%= @model %> was successfully destroyed.' else flash[:error] = 'Unable to destroy <%= @model %>!' end redirect url(:<%= @pluralized %>, :index) end <% end -%> end