I went through a tutorial at
http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=1 to get
started with RoR. I really like the idea of the scaffold construct, but
I can''t seem to get it to work the way it was described in the
tutorial.
I''ve got a mysql database that is properly configured, and a table
called ''quotes'' with a column called
''quote'', and an auto incrementing
primary key of ''id''. Below is my controller code and model,
and the
error I get. Anyone have any idea why this doesn''t just work? Btw,
I''ve got Ruby 1.8.4 (2006-04-14) [i386-mswin32], and I can''t
figure out
what version of Rails (or even RubyGems...I used this last night to
install Rails).
In app/controllers:
class QuoteController < ApplicationController
scaffold :quote
end
In app/models:
class Quote < ActiveRecord::Base
end
Here is the error I got:
ArgumentError in Quote#index
Showing
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml
where line #13 raised:
wrong number of arguments (0 for 1)
Extracted source (around line #13):
10: <% for entry in
instance_variable_get("@#{@scaffold_plural_name}")
%>
11: <tr>
12: <% for column in @scaffold_class.content_columns %>
13: <td><%= entry.send(column.name) %></td>
14: <% end %>
15: <td><%= link_to "Show", :action =>
"show#{@scaffold_suffix}",
:id => entry %></td>
16: <td><%= link_to "Edit", :action =>
"edit#{@scaffold_suffix}",
:id => entry %></td>
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:13:in
`quote''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:13:in
`_run_rhtml_c__dev_ruby_lib_ruby_gems_1468_gems_actionpack_14612465_lib_action_controller_templates_scaffolds_list''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:12:in
`_run_rhtml_c__dev_ruby_lib_ruby_gems_1468_gems_actionpack_14612465_lib_action_controller_templates_scaffolds_list''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:10:in
`_run_rhtml_c__dev_ruby_lib_ruby_gems_1468_gems_actionpack_14612465_lib_action_controller_templates_scaffolds_list''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in
`compile_and_render_template''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in
`render_template''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in
`render_file''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:168:in
`render_scaffold''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:110:in
`list''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:97:in
`index''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in
`perform_action_without_filters''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue''
c:/dev/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in
`perform_action''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
`process_without_filters''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in
`process_without_session_management_support''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in
`process''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
`dispatch''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in
`handle_dispatch''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in
`service''
c:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service''
c:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in
`dispatch''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59
c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''
c:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30
c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''
c:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require''
script/server:3
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:13:in
`quote''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:13:in
`_run_rhtml_c__dev_ruby_lib_ruby_gems_1468_gems_actionpack_14612465_lib_action_controller_templates_scaffolds_list''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:12:in
`_run_rhtml_c__dev_ruby_lib_ruby_gems_1468_gems_actionpack_14612465_lib_action_controller_templates_scaffolds_list''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/scaffolds/list.rhtml:10:in
`_run_rhtml_c__dev_ruby_lib_ruby_gems_1468_gems_actionpack_14612465_lib_action_controller_templates_scaffolds_list''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:316:in
`compile_and_render_template''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:292:in
`render_template''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_view/base.rb:251:in
`render_file''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:168:in
`render_scaffold''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:110:in
`list''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/scaffolding.rb:97:in
`index''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:941:in
`perform_action_without_filters''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue''
c:/dev/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/rescue.rb:82:in
`perform_action''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:408:in
`process_without_filters''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in
`process_without_session_management_support''
c:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in
`process''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
`dispatch''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in
`handle_dispatch''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in
`service''
c:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service''
c:/dev/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start''
c:/dev/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in
`dispatch''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59
c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''
c:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require''
c:/dev/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30
c:/dev/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''
c:/dev/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require''
script/server:3
Request
Parameters: None
Show session dump
---
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers: {"cookie"=>[],
"Cache-Control"=>"no-cache"}
--
Posted via http://www.ruby-forum.com/.