Sha256: f5adef518bcbe13855005778157dd334f5103767d3ee97722354826609cc6fab
Contents?: true
Size: 1.43 KB
Versions: 9
Compression:
Stored size: 1.43 KB
Contents
require 'rho/rhocontroller' class <%= class_name %>Controller < Rho::RhoController #GET /<%= class_name %> def index @<%= name.downcase.pluralize %> = <%= class_name %>.find(:all) render end # GET /<%= class_name %>/{1} def show @<%= name.downcase %> = <%= class_name %>.find(@params['id']) if @<%= name.downcase %> render :action => :show else redirect :action => :index end end # GET /<%= class_name %>/new def new @<%= name.downcase %> = <%= class_name %>.new render :action => :new end # GET /<%= class_name %>/{1}/edit def edit @<%= name.downcase %> = <%= class_name %>.find(@params['id']) if @<%= name.downcase %> render :action => :edit else redirect :action => :index end end # POST /<%= class_name %>/create def create @<%= name.downcase %> = <%= class_name %>.new(@params['<%= name.downcase %>']) @<%= name.downcase %>.save redirect :action => :index end # POST /<%= class_name %>/{1}/update def update @<%= name.downcase %> = <%= class_name %>.find(@params['id']) @<%= name.downcase %>.update_attributes(@params['<%= name.downcase %>']) if @<%= name.downcase %> redirect :action => :index end # POST /<%= class_name %>/{1}/delete def delete @<%= name.downcase %> = <%= class_name %>.find(@params['id']) @<%= name.downcase %>.destroy if @<%= name.downcase %> redirect :action => :index end end
Version data entries
9 entries across 9 versions & 1 rubygems