Sha256: 60d6c91396756cce29eabcd92ffc3c65a92f8cf45bd7c3695461913c285aa935

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

require 'rho/rhocontroller'

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

  # GET /<%= class_name %>/1
  def show
    @<%= name.pluralize %> = <%= class_name %>.find(@params['object'])
  end

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

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rhodes-0.2.0 generators/templates/model/controller.rb
rhodes-0.1.3 generators/templates/model/controller.rb
rhodes-0.1.0 generators/templates/model/controller.rb
rhodes-0.1.1 generators/templates/model/controller.rb
rhodes-0.1.2 generators/templates/model/controller.rb