Sha256: 81d777f6ab5f15764dd6bcadc74d35bb8f1814d99b04f595dcb3002f6d88e29a

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'rho/rhocontroller'

class <%= class_name %>Controller < Rho::RhoController

  #GET /<%= class_name %>
  def index
    @<%= name.pluralize %> = <%= class_name %>.find(:all)
    render
  end

  # GET /<%= class_name %>/1
  def show
    @<%= name %> = <%= class_name %>.find(@params['id'])
    render :action => :show
  end

  # GET /<%= class_name %>/new
  def new
    @<%= name %> = <%= class_name %>.new
    render :action => :new
  end

  # GET /<%= class_name %>/1/edit
  def edit
    @<%= name %> = <%= class_name %>.find(@params['id'])
    render :action => :edit
  end

  # POST /<%= class_name %>/create
  def create
    @<%= name %> = <%= class_name %>.new(@params['<%= name %>'])
    @<%= name %>.save
    redirect :action => :index
  end

  # POST /<%= class_name %>/1/update
  def update
    @<%= name %> = <%= class_name %>.find(@params['id'])
    @<%= name %>.update_attributes(@params['<%= name %>'])
    redirect :action => :index
  end

  # POST /<%= class_name %>/1/delete
  def delete
    @<%= name %> = <%= class_name %>.find(@params['id'])
    @<%= name %>.destroy
    redirect :action => :index
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rhodes-0.3.0 generators/templates/model/controller.rb
rhodes-0.2.6 generators/templates/model/controller.rb