NoMethodError in new scaffold


#1

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:


2: <%=h @exception.original_exception.class.to_s %> in
3: <%=h @request.parameters[“controller”].capitalize if
@request.parameters[“controller”]%>#<%=h @request.parameters[“action”]
%>
4:


5:
6:

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 | | | |
±-----------------±------------±-----±----±--------±---------------+


#2

‘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?


#3

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 :slight_smile:

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?