Sha256: 77080f186c45d929b576a0cdad07a3645868d07cd72c0ff2f94956756302aaba
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
class Admin::<%= controller_name.pluralize %>Controller < Admin::BaseController def index @<%= controller_name.underscore.pluralize %> = <%= controller_name %>.all end def new @<%= controller_name.underscore %> = <%= controller_name %>.new end def create @<%= controller_name.underscore %> = <%= controller_name %>.new params[:<%= controller_name.underscore %>] if @<%= controller_name.underscore %>.save redirect_to <%= controller_name.underscore.pluralize %>_path else render action: :new end end def edit @<%= controller_name.underscore %> = <%= controller_name %>.find params[:id] end def update @<%= controller_name.underscore %> = <%= controller_name %>.find params[:id] if @<%= controller_name.underscore %>.update_attributes params[:<%= controller_name.underscore %>] redirect_to <%= controller_name.underscore.pluralize %>_path else render action: :edit end end def destroy @<%= controller_name.underscore %> = <%= controller_name %>.find params[:id] @<%= controller_name.underscore %>.destroy redirect_to <%= controller_name.underscore.pluralize %>_path end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pixelforce_cms-0.2 | lib/generators/pixelforce_cms/templates/admin_controller.rb |