Sha256: 42f3d63133a3cab14dfa7ed51a7a32ee8700e355351dfcaba5215e59c31f92bc
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
class Admin::<%= plural_class_name %>Controller < ApplicationController menu_item :<%= plural_name %> respond_to :html def index @<%= plural_name %> = <%= class_name %>.paginate :page => params[:page], :per_page => 15 respond_with(:admin, @<%= plural_name %>) end def show @<%= singular_name %> = <%= class_name %>.find(params[:id]) respond_with(:admin, @<%= singular_name %>) end def new @<%= singular_name %> = <%= class_name %>.new respond_with(:admin, @<%= singular_name %>) end def edit @<%= singular_name %> = <%= class_name %>.find(params[:id]) end def create @<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>]) flash[:notice] = '<%= class_name %> foi criado com sucesso.' if @<%= singular_name %>.save respond_with(:admin, @<%= singular_name %>) end def update @<%= singular_name %> = <%= class_name %>.find(params[:id]) flash[:notice] = '<%= class_name %> foi alterado com sucesso.' if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>]) respond_with(:admin, @<%= singular_name %>) end def destroy @<%= singular_name %> = <%= class_name %>.find(params[:id]) flash[:notice] = '<%= class_name %> foi excluĂdo com sucesso.' if @<%= singular_name %>.destroy respond_with(:admin, @<%= singular_name %>) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flexi_generators-0.2.3 | lib/generators/flexi_scaffold/templates/controller.rb |
flexi_generators-0.2.2 | lib/generators/flexi_scaffold/templates/controller.rb |