Forum: Ruby on Rails NoMethodError in new scaffold

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.
Leo (Guest)
on 2005-12-28 00:25
Hi All,
I created a new rails application using rails 1.0.  I used "ruby
script\generate scaffold" for each of my tables.  This worked on all but
2 of my tables.  When I go to the new or edit action of my requests or
admins table, I get the error below.
  On one table called admins I hadn't followed the correct naming
convention and wasn't able to edit or create records.  However, once I
modified the table and re-created the scaffold it worked.    However,
I've double checked my naming conventions on my requests table and can't
figure this out.  I also cannot find the line "<%=h
@request.parameters["controller"].capitalize if" in any files. I've
searched the mailing list and google and found many similar issues but I
don't see this particular issue or any answers.  Any help would be
appreciated.
thanks,
Leo




Here's the error I'm getting
 NoMethodError in Requests#new

Showing
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/templates/rescues/template_error.rhtml
where line #3 raised:

undefined method `parameters' for #<Request:0x393ab60>

Extracted source (around line #3):

1: <h1>
2:   <%=h @exception.original_exception.class.to_s %> in
3:   <%=h @request.parameters["controller"].capitalize if
@request.parameters["controller"]%>#<%=h @request.parameters["action"]
%>
4: </h1>
5:
6: <p>




Table Definition:

mysql> desc requests;
+------------------+-------------+------+-----+---------+----------------+
| Field            | Type        | Null | Key | Default | Extra          |
+------------------+-------------+------+-----+---------+----------------+
| id               | int(11)     | NO   | PRI | NULL    | auto_increment |
| problemsite_id   | int(11)     | NO   |     |         |                |
| project_id       | int(11)     | NO   |     |         |                |
| requesttype_id   | int(11)     | NO   |     |         |                |
| ostype_id        | int(11)     | NO   |     |         |                |
| requeststatus_id | int(11)     | NO   |     |         |                |
| description      | text        | NO   |     |         |                |
| actiontaken      | text        | YES  |     | NULL    |                |
| admin_id         | int(11)     | NO   |     |         |                |
| wwid             | varchar(8)  | NO   |     |         |                |
| idsid            | varchar(8)  | NO   |     |         |                |
| name             | varchar(50) | NO   |     |         |                |
| email            | varchar(50) | NO   |     |         |                |
| phone            | varchar(30) | NO   |     |         |                |
| altphone         | varchar(30) | YES  |     | NULL    |                |
| badgecolor       | varchar(2)  | YES  |     | NULL    |                |
| iscc             | varchar(2)  | NO   |     |         |                |
| orgu             | varchar(50) | NO   |     |         |                |
+------------------+-------------+------+-----+---------+----------------+
Wilson B. (Guest)
on 2005-12-28 00:58
(Received via mailing list)
'Request' is a name that already belongs to Rails (handling the HTTP
request from the user).  It's one of a semi-short list of things you
can't name your models or controllers.
The easiest solution is to choose a different name for the model.
Maybe something like UserRequest or CustomerRequest?
Leo (Guest)
on 2005-12-30 21:14
Thank you very much! that worked!  I've ordered the Agile Web
Development with Rails book so hopefully I will not make these types of
mistakes in the future :)






Wilson B. wrote:
> 'Request' is a name that already belongs to Rails (handling the HTTP
> request from the user).  It's one of a semi-short list of things you
> can't name your models or controllers.
> The easiest solution is to choose a different name for the model.
> Maybe something like UserRequest or CustomerRequest?
This topic is locked and can not be replied to.