I''m new to RonR, so I thought I''d try something simple.
/tools ron$ script/generate model widget
/tools ron$ rake db:migrate
where "001_create_widgets.rb"
is
"class CreateWidgets < ActiveRecord::Migration
def self.up
create_table :widgets do |t|
# t.column :name, :string
t.column "name", :string
t.column "function", :string
t.column "method", :string
t.column "created", :datetime
end
end
def self.down
drop_table :widgets
end
end"
Everthing worked as advertised a table "widgets" was created in
"tools_develoment"
I then invoked scafolding as follows:
/tools ron$ script/generate controller widget
with "widget_controller.rb" containing:
"class WidgetController < ApplicationController
scaffold :widget
end"
pointed my browser at http://localhost:3000/widget
I got the expected CRUD page
When I attemped to create a new widget the data base got updated ok
when I checked later but from deep in the bowels of RonR I get this
exception:
"ArgumentError in Widget#list
Showing
Applications/Locomotive2/Bundles/rmagickRailsSept2006_x86.locobundle/framework/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: /Users/ron/tools/public/../config/.. "
Is this a bug or am I doing something wrong? Any ideas???
Thanks,
RonOnRails
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
The problem is your column called "method". It''s clashing with the "method" method which exists on every Ruby object. See http://corelib.rubyonrails.org/classes/Object.html#M001081. Not sure what the best solution is. RonOnRails wrote:> I''m new to RonR, so I thought I''d try something simple. > > /tools ron$ script/generate model widget > /tools ron$ rake db:migrate > > where "001_create_widgets.rb" > > is > > "class CreateWidgets < ActiveRecord::Migration > def self.up > create_table :widgets do |t| > # t.column :name, :string > t.column "name", :string > t.column "function", :string > t.column "method", :string > t.column "created", :datetime > end > end > > def self.down > drop_table :widgets > end > end" > > Everthing worked as advertised a table "widgets" was created in > "tools_develoment" > I then invoked scafolding as follows: > > /tools ron$ script/generate controller widget > > with "widget_controller.rb" containing: > > "class WidgetController < ApplicationController > scaffold :widget > end" > > pointed my browser at http://localhost:3000/widget > > I got the expected CRUD page > > When I attemped to create a new widget the data base got updated ok > when I checked later but from deep in the bowels of RonR I get this > exception: > > "ArgumentError in Widget#list > > Showing > Applications/Locomotive2/Bundles/rmagickRailsSept2006_x86.locobundle/framework/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: /Users/ron/tools/public/../config/.. " > > Is this a bug or am I doing something wrong? Any ideas??? > > Thanks, > RonOnRails > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Rename the field. c. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yep that did it changed "method" to "means" and it worked like a charm. Thanks RonOn Rails Cayce Balara wrote:> Rename the field. > > c. > > -- > Posted via http://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---