I''m a newbie. My first app is using a table called cases. With just "scaffold :case" I get the basic list to show up. I just did a "generate scaffold case case" (I think that is correct). Now when I try to list my cases, I''m getting a syntax error on all of the view source code that references "case". ie. <% for case in @cases %> Thanks Greg -- Greg Freemyer The Norcross Group Forensics for the 21st Century
''case'' is a Ruby reserved word. -Chris Greg Freemyer wrote:>I''m a newbie. > >My first app is using a table called cases. With just "scaffold >:case" I get the basic list to show up. > >I just did a "generate scaffold case case" (I think that is correct). > >Now when I try to list my cases, I''m getting a syntax error on all of >the view source code that references "case". > >ie. <% for case in @cases %> > >Thanks >Greg >-- >Greg Freemyer >The Norcross Group >Forensics for the 21st Century >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >
"case" is used for switch statements in Ruby. Try renaming your local variable and see if it works. <% for a_case in @cases %> On 12/21/05, Greg Freemyer <greg.freemyer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m a newbie. > > My first app is using a table called cases. With just "scaffold > :case" I get the basic list to show up. > > I just did a "generate scaffold case case" (I think that is correct). > > Now when I try to list my cases, I''m getting a syntax error on all of > the view source code that references "case". > > ie. <% for case in @cases %> > > Thanks > Greg > -- > Greg Freemyer > The Norcross Group > Forensics for the 21st Century > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On Wed, Dec 21, 2005 at 07:37:51PM -0500, Greg Freemyer wrote:> I''m a newbie. > > My first app is using a table called cases. With just "scaffold > :case" I get the basic list to show up. > > I just did a "generate scaffold case case" (I think that is correct). > > Now when I try to list my cases, I''m getting a syntax error on all of > the view source code that references "case". > > ie. <% for case in @cases %>Yes, ''case'' is part of Ruby''s syntax. answer = ''yes'' case answer when ''yes'' # ... when ''no # ... end marcel -- Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>
On 12/21/05, Lee Marlow <lee.marlow-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> "case" is used for switch statements in Ruby. > > Try renaming your local variable and see if it works. > > <% for a_case in @cases %> >Works like a champ. Will having a table called cases give me ongoing problems, or is it safe to proceed like this? Thanks Greg -- Greg Freemyer The Norcross Group Forensics for the 21st Century