First: I''m new to Rails! Second: Nice framework in a nice language! I use the latest and greatest version of Rails (just updated with gem) and the same for Ruby and it''s all running on Windows with MySQL 4.1.xx I have a database containing (among others) the following table: create table templates ( id int(11) not null auto_increment, file_name varchar(255) not null, updated_at datetime not null, created_at datetime not null, primary key(id) ); I update the database config and do script/generate scaffold Template. Everything is generated fine. When I fire up the server and goes to /templates I get to the list view (with no items though). When I try to go to /templates/new I get an error (see below). If I finish the action method with a render_text it seems to work but I don''t want to do that. Can anyone tell me what I''ve done wrong (I''ve gone the exact same route as I''ve done earlier when it did work)? I have also tried creating an Admin controller that had a new_template method with the exact same result. /Marcus Error messages: NoMethodError in Templates#new undefined method `render_file'' for #<Template:0x386f248> script/server:49 Trace: c:/marcus/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_rec ord/base.rb:1203:in `method_missing'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/rescue.rb:71:in `rescue_action_locally'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/rescue.rb:31:in `rescue_action'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/rescue.rb:106:in `perform_action'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/base.rb:356:in `send'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/base.rb:356:in `process'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32: in `dispatch'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb :105:in `handle_dispatch'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb :71:in `service'' c:/marcus/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' c:/marcus/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb :57:in `dispatch''
It seems that if I rename my model to Teemplate (and table to teemplates) it works perfectly. I checked http://wiki.rubyonrails.com/rails/show/ReservedWords and template doesn''t seem to be a reserved word in RoR. Is there a bug here or just a miss in the documentation (or perhaps that I missed something in the docs...)? /Marcus -----Original Message----- From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Marcus Andersson Sent: den 12 juli 2005 18:57 To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails] Problems with a certain name (template)? I have a database containing the following table: create table templates ( id int(11) not null auto_increment, file_name varchar(255) not null, updated_at datetime not null, created_at datetime not null, primary key(id) ); I update the database config and do script/generate scaffold Template. Everything is generated fine. When I fire up the server and goes to /templates I get to the list view (with no items though). When I try to go to /templates/new I get an error (see below). If I finish the action method with a render_text it seems to work but I don''t want to do that. Can anyone tell me what I''ve done wrong (I''ve gone the exact same route as I''ve done earlier when it did work)? I have also tried creating an Admin controller that had a new_template method with the exact same result. /Marcus Error messages: NoMethodError in Templates#new undefined method `render_file'' for #<Template:0x386f248> script/server:49 Trace: c:/marcus/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_rec ord/base.rb:1203:in `method_missing'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/rescue.rb:71:in `rescue_action_locally'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/rescue.rb:31:in `rescue_action'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/rescue.rb:106:in `perform_action'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/base.rb:356:in `send'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_contro ller/base.rb:356:in `process'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32: in `dispatch'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb :105:in `handle_dispatch'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb :71:in `service'' c:/marcus/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' c:/marcus/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:94:in `start'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:89:in `each'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:89:in `start'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/marcus/ruby/lib/ruby/1.8/webrick/server.rb:79:in `start'' c:/marcus/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb :57:in `dispatch'' _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
"Marcus Andersson" <ma-F/E6tIDLPvR6nIa31vAvqA@public.gmane.org> writes:> It seems that if I rename my model to Teemplate (and table to > teemplates) it works perfectly. I checked > http://wiki.rubyonrails.com/rails/show/ReservedWords and template > doesn''t seem to be a reserved word in RoR.My guess is that it''s just not in the ReservedWords list yet and should be. AFAIK, that list is maintained basically as someone finds a conflict like you did. -- doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org