Sha256: af33aa3ba39587abaec8a9ac2c5b76aa280027329a9e02e1f9d5a9e4d334da53
Contents?: true
Size: 1.52 KB
Versions: 13
Compression:
Stored size: 1.52 KB
Contents
<%= @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
Version data entries
13 entries across 13 versions & 1 rubygems