I have just upgraded the application from Rails 2 to Rails 3 (ruby 1.9.2-head).
Most models are recognized after the upgrade, however one model called “Villa” is not recognized at all and returns an “undefined method” error if you try to call any methods on it (e.g Villa.find(1) ).
The simplified code for the model is, but I have changed this in every which way and it doesn’t seem to solve the problem:
class Villa < ActiveRecord::Base
belongs_to :beach
has_many :villa_pictures, :order => "id ASC"
has_many :villa_rooms, :order => "id ASC"
has_many :villa_facilities
default_scope :conditions => ["active = ?", "true"]
end
From the console, typing in “Villa” will simply return => Villa, whereas the other models will return their table definition.
Thanks in advance.
The
Villaconstant might already be defined. You don’t have any other classes or modules elsewhere? Or is your application called “villa”? That would defineVillain config/application.rb by default.