Sha256: e968d76879e7d806a65d455ecadb19a9c3b1eebad7d3d44934164c78a1352686
Contents?: true
Size: 1.7 KB
Versions: 1
Compression:
Stored size: 1.7 KB
Contents
Admin.controllers :<%= @orm.name_plural %> do get :index do @<%= @orm.name_plural %> = <%= @orm.all %> render '<%= @orm.name_plural %>/index' end get :new do @<%= @orm.name_singular %> = <%= @orm.build %> render '<%= @orm.name_plural %>/new' end post :create do @<%= @orm.name_singular %> = <%= @orm.build("params[:#{@orm.name_singular}]") %> if <%= @orm.save %> flash[:notice] = "#{mt(<%= @orm.klass_name %>)} was successfully created." redirect url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular%>.id) else flash.now[:error] = "There were some problems creating this #{mt(<%= @orm.klass_name %>)}." render '<%= @orm.name_plural %>/new' end end get :edit, :with => :id do @<%= @orm.name_singular %> = <%= @orm.find("params[:id]") %> render '<%= @orm.name_plural %>/edit' end put :update, :with => :id do @<%= @orm.name_singular %> = <%= @orm.find("params[:id]") %> if <%= @orm.update_attributes("params[:#{@orm.name_singular}]") %> flash[:notice] = "#{mt(<%= @orm.klass_name %>)} was successfully updated." redirect url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular %>.id) else flash.now[:error] = "There were some problems updating this #{mt(<%= @orm.klass_name %>)}." render '<%= @orm.name_plural %>/edit' end end delete :destroy, :with => :id do <%= @orm.name_singular %> = <%= @orm.find("params[:id]") %> if <%= @orm.destroy %> flash[:notice] = "#{mt(<%= @orm.klass_name %>)} was successfully destroyed." else flash[:error] = 'Unable to destroy #{mt(<%= @orm.klass_name %>)}!' end redirect url(:<%= @orm.name_plural %>, :index) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootstrap-on-0.0.5 | lib/bootstrap-on/templates/page/controller.rb.tt |