Forum: Ruby on Rails One model won't work like the others, generating weird error

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Chris H. (Guest)
on 2006-04-13 19:31
I've been banging my head against this for quite some time and can't
figure out what is going on.  I'm doing up a web site based on Typo and
adding in some custom controllers.  I'm running Typo from trunk, so it's
using the version of rails in vendor/rails.  Everything is going
smoothly...until now.

I have one model that JUST. WON'T. WORK.  Whenever I call it, I get the
following error:

(eval):1:in `compute_type': compile error
(eval):1: parse error, unexpected tINTEGER

The model itself couldn't be any simpler:

class Team < ActiveRecord::Base

The controller calling it is as follows:

 class RostersController < ContentController
  layout :theme_layout
  helper :articles
  model :team

  def index
    ac_teams =
    nc_teams =
    result = Team.find(:all)
    #if params[:id] == "ac"
    #  @team_rosters = get_rosters(ac_teams)
    #elsif params[:id] == "nc"
    #  @team_rosters = get_rosters(nc_teams)
    #  @team_rosters = get_rosters(ac_teams)
    #  @team_rosters << get_rosters(nc_teams)


It chokes on the Team.find line, spewing out the above-mentioned error.
Two other models that are in use work just fine.

Any thoughts?  Suggestions?  This is driving me nucking futs.
Chris H. (Guest)
on 2006-04-13 20:21
(wow, answering oneself is so weird)

Turns out the problem was that one of the fields in the table was called
'type', and for whatever reason Rails didn't like it.

Chris H. wrote:
> Any thoughts?  Suggestions?  This is driving me nucking futs.
Daniel H. (Guest)
on 2006-04-13 20:53
(Received via mailing list)
Hi Chris,

Rails reserves columns named "type" for single table inheritance:

I actually had this same problem and think it would be great if there
someway you could have a column named "type" without having single table

This topic is locked and can not be replied to.