views:

134

answers:

2

Hi all,

I'm new to rails, but not to programming. I'm trying to create a Case Management app, I'm running the command

ruby script/generate scaffold Case casename:string caseid:string

This works fine, however because Case is a reserved word I'm getting errors when trying to view localhost:3000/Cases

Is there anyway around this or do I just have to use a different name?

Thanks in advance.

+1  A: 

Is there anyway around this or do I just have to use a different name?

There are some words that you can't work around (see below). There may be a way to work around 'case' but you'll make life easier on yourself by changing the name. Don't sweat the small things - there're are plenty of real problems to worry about :-)

Other reserved words here and here

Good luck!

Chris McCauley
+1  A: 

Think you are going to cause yourself more grief than it's worth, personally I would avoid reserved words if at all possible.

The errors are specific to using the word case, so if you still want to, you can make things work if you alter the default views from:

<% @cases.each do |case| %>
<tr>
<td><%=h case.casename %></td>
…

to:

<% @cases.each do |c| %>
<tr>
<td><%=h c.casename %></td>
…
Paul Groves