Forum: Ruby on Rails Newbie Help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
026b6055c4c2a996a77ec04ebd8133e3?d=identicon&s=25 Donald Brady (dbrady010)
on 2006-05-03 19:10
Is it my environment? Is something wrong, cause I thought this should
just work?

I have a simple table and I created a model and a controller:

ruby script/generate controller Restaurant
ruby script/generate model Restaurant

I edited the controller to this:

class RestaurantController < ApplicationController
  scaffold :Restaurant
end

I run it and:

http://0.0.0.0:3000/Restaurant works fine, gives me a list of
restaurants.

If I click on edit though I get this:

Showing
usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/templates/scaffolds/edit.rhtml
where line #4 raised:

wrong number of arguments (0 for 1)
Extracted source (around line #4):

1: <h1>Editing <%= @scaffold_singular_name %></h1>
2:
3: <%= error_messages_for(@scaffold_singular_name) %>
4: <%= form(@scaffold_singular_name, :action =>
"update#{@scaffold_suffix}") %>
5:
6: <%= link_to "Show", :action => "show#{@scaffold_suffix}", :id =>
instance_variable_get("@#{@scaffold_singular_name}") %> |
7: <%= link_to "Back", :action => "list#{@scaffold_suffix}" %>

Likewise if I click on New:

ArgumentError in Restaurant#new

Showing
usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/templates/scaffolds/new.rhtml
where line #4 raised:

wrong number of arguments (0 for 1)
Extracted source (around line #4):

1: <h1>New <%= @scaffold_singular_name %></h1>
2:
3: <%= error_messages_for(@scaffold_singular_name) %>
4: <%= form(@scaffold_singular_name, :action =>
"create#{@scaffold_suffix}") %>
5:
6: <%= link_to "Back", :action => "list#{@scaffold_suffix}" %>


Here's my table definition;

CREATE TABLE `restaurants` (
  `id` INTEGER NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(100) NOT NULL DEFAULT '',
  `phone` VARCHAR(14) NOT NULL DEFAULT '',
  `fax` VARCHAR(14) NOT NULL DEFAULT '',
  `email` VARCHAR(100) DEFAULT '',
  `web` VARCHAR(100) DEFAULT '',
  `address1` VARCHAR(100) NOT NULL DEFAULT '',
  `address2` VARCHAR(100) DEFAULT '',
  `city` VARCHAR(100) NOT NULL DEFAULT '',
  `state` CHAR(2) NOT NULL DEFAULT '',
  `zip` VARCHAR(10) NOT NULL DEFAULT '',
  `open` BOOLEAN NOT NULL DEFAULT 0,
  PRIMARY KEY(`id`)
)
ENGINE = InnoDB
CHARACTER SET utf8;

This on Mac OSX. I set up Ruby and Rails accoring to this:

http://hivelogic.com/articles/2005/12/01/ruby_rail...
Fd22ee3cfc7dac283ce8e451af324f7d?d=identicon&s=25 Chad Perrin (Guest)
on 2007-09-25 23:10
(Received via mailing list)
On Mon, Sep 17, 2007 at 05:51:53AM +0900, Gaspard Bucher wrote:
>
> Here are the results. You gain 10% speed by using symbols in such a situation.

In short, then, it looks like I was right: all else being equal, symbols
are a little faster than strings, but don't (generally) leave the hash
table that stores them so too many symbols may undesirably increase
memory usage.
This topic is locked and can not be replied to.