Skip to content

Instantly share code, notes, and snippets.

@ngelx
Created November 26, 2011 16:18
Show Gist options
  • Save ngelx/1395927 to your computer and use it in GitHub Desktop.
Save ngelx/1395927 to your computer and use it in GitHub Desktop.
Relational problem
The problem is this:
class Cmr < ActiveRecord::Base
belongs_to :ruta
...
end
class Cmr24 < Cmr
...
end
class Ruta < ActiveRecord::Base
has_many :cmrs, :dependent => :nullify
...
end
ruby-1.9.2-p0 > @cmr = Cmr.first
Cmr Load (0.1ms) SELECT `cmrs`.* FROM `cmrs` LIMIT 1
=> #<Cmr24 id: 633, codigo: "C1060", cmr_type: nil, direccion: "Maipu 1685", status: 1, ruta_id: 22, type: "Cmr24", zona: nil>
ruby-1.9.2-p0 > @cmr.ruta
Mysql2::Error: Table 'eco_development.ruta' doesn't exist: SHOW FIELDS FROM `ruta` .....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment