Sha256: 767de726c0b9344e559df528631e3bd33f2c6d51732fd7b8a385d8323df8a38c
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
<% module_namespacing do -%> class <%= controller_class_name %>Controller < ApplicationController <% unless options[:singleton] -%> def index @<%= table_name %> = <%= orm_class.all(class_name) %> respond_with(@<%= table_name %>) end <% end -%> def show @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %> respond_with(@<%= file_name %>) end def new @<%= file_name %> = <%= orm_class.build(class_name) %> respond_with(@<%= file_name %>) end def edit @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %> end def create @<%= file_name %> = <%= orm_class.build(class_name, "params[:#{file_name}]") %> <%= "flash[:notice] = '#{class_name} was successfully created.' if " if flash? %>@<%= orm_instance.save %> respond_with(@<%= file_name %>) end def update @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %> <%= "flash[:notice] = '#{class_name} was successfully updated.' if " if flash? %>@<%= orm_instance.update_attributes("params[:#{file_name}]") %> respond_with(@<%= file_name %>) end def destroy @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %> @<%= orm_instance.destroy %> respond_with(@<%= file_name %>) end end <% end -%>
Version data entries
3 entries across 3 versions & 1 rubygems