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
Matthew wrote:>
> 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:
>
>
> <html>
> <head>
> <title>Listing ofdata</title>
> </head>
>
> <body>
>
> <h1> List </h1>
>
> <table border=1>
> <tr>
> <td><p
align="center"><i><b>ID</b></i></td>
> <td><p
align="center"><i><b>Name</b></i></td>
>
> </tr>
>
> <% @data.each do |public| %>
> <tr>
> <td><%= public.id %></td>
> <td><%= public.name %></td>
> </tr>
> <% end %>
> </table>
>
> <p><%= link_to "Create New Entry", :action =>
"new" %></p>
>
> </body>
> </html>
>
>
>
> The error generated is:
>
> undefined local variable or method `public'' for
> #<PublicController:0x37f9dbc>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---