Newbie CRUD problem


#1

Hi,

This is my first effort with RoR using the onlamp.com tutorial
(http://www.onlamp.com/lpt/a/5546). I want to simply replace the example
using my own table called “public”.

My controller looks like:

class GlycanPublicController < ApplicationController
scaffold :public

def list
    @data = public.find_all
end

end

and the views file list.rhtml:

Listing ofdata

List

<% @data.each do |public| %>

<% end %>

ID

Name

<%= public.id %> <%= public.name %>

<%= link_to "Create New Entry", :action => "new" %>

The error generated is:

undefined local variable or method `public’ for
#PublicController:0x37f9dbc


#2

Most likely this will be fixed by capitalizing the “p” in
public.find_all . Also, current usage is find(:all) rather than
find_all, so the complete method would look like:

Public.find(:all)

Daniel