That's what I thought it meant. But I've searched through my code and I can't find any instance of "rbController", would it have been left over from the scaffolding stuff?
Here's my jobs_controller.rbclass JobsController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see
http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@category = @params['category']
@jobs = Job.find_all
end
def show
@job = Job.find(params[:id])
end
def new
@job = Job.new
@categories = Category.find_all
end
def create
@job = Job.new(params[:job])
if @job.save
flash[:notice] = 'Job was successfully created.'
redirect_to :action => 'list'
else
render :action => 'new'
end
end
def edit
@job = Job.find(params[:id])
@categories = Category.find_all
end
def update
@job = Job.find(params[:id])
if @job.update_attributes(params[:job])
flash[:notice] = 'Job was successfully updated.'
redirect_to :action => 'show', :id => @job
else
render :action => 'edit'
end
end
def delete
Job.find(@params['id']).destroy
flash[:notice] = 'Job was deleted.'
redirect_to :action => 'list'
end
end
Here's my list.rhtml in view<div id="table">
<table border="0">
<tr>
<td width="30%"><h3>Position</h3></td>
<td width="30%"><h3>Employer</h3></td>
<td width="20%"><h3>Category</h3></td>
<td width="10%"><h3>Added</h3></td>
</tr>
<% @jobs.each do |job| %>
<% if (@category == nil) || (@category == job.category.name)%>
<tr>
<td>
<%= link_to job.position,
:action => "show",
:id => job.id %>
</td>
<td>
<%= job.employer%>
</td>
<td>
<%= link_to job.category.name,
:action => "list",
:category => "#{job.category.name}" %>
</td>
<td>
<%= job.date %>
</td>
</tr>
<% end %>
<% end %>
</table>
</div>
<br><br>
I should probably mention that I built this app from following
this tutorial and making minor changes.