This code works on an older version of Ruby and Rails but not with
Ruby 1.8.6 and Rails 1.2.5. The code is so simple that I can’t figure
out where the problem is.
class ProfileController < ApplicationController
@profile = Profile.find_by_school_id(params[:id])
class Profile < ActiveRecord::Base
translates :text #<— I’m using the Globalize plugin
NameError in ProfileController#show
uninitialized constant Profile
If I change the query to @profile = Foobar.find(:first, :conditions =>
[“school_id = ?”, params[:id]])
I get a similar error, but it also adds:
This error occured while loading the following files:
…so I assume it knows about the profile.rb model. Why is it saying
Profile is an uninitialized constant, and why does this braindead
simple code work fine in an older version of Rails but not the latest?