On Jan 12, 12:59 pm, Caesar <caesar.in...@gmail.com> wrote:
> I also had the same problem. My application is running rails 2.0.2.
> Has anyone actually found a good solution for this?
>
The error message is misleading. Expected foo.rb to define Foo usually
just means that something bad happened when loading foo.rb (syntax
errors, missing constant etc...). You can usually get a better error
message by just typing Foo into script/console
Fred
> On Nov 25 2008, 11:35 am, Sarah Gray <rails-mailing-l...@andreas-
>
> s.net> wrote:
> > Let me just add that while what I wrote above did work a few times, the
> > problem recurred. So I would not say that is a good solution. At this
> > point I manually required my classes in the other class:
>
> > require 'project'
> > require 'asset'
> > ...
>
> > and this seems to work. It is a mystery to me, but hope someone else
> > is helped.
>
> > sg.
>
> > Sarah Gray wrote:
> > > Hello,
>
> > > I wanted to chime in because I had a similar proble, Expected /
> > > .../app/controllers/application.rb to define Application. On production
> > > only. Rails 2.1.2, apache2, passenger. This thread was helpful and I
> > > found in my stack trace the noted const_missing, originating at line 90
> > > in one of my classes, permission.rb
>
> > > <pre>
> > > vendor/rails/activesupport/lib/active_support/dependencies.rb:484:in
> > > `const_missing'
> > > app/models/permission.rb:90:in `initialize_project'
> > > </pre>
>
> > > The method in question had a case statement like so:
>
> > > <pre>
> > > @project ||= case @resource
> > > when Project
> > > @resource
> > > ....
> > > end
> > > </pre>
>
> > > It was crapping out on line 90, which was:
> > > <pre>
> > > when Project
> > > </pre>
>
> > > I tried giving it an absolute path to Project, like so:
> > > <pre>
> > > @project ||= case @resource
> > > when ::Project
> > > @resource
> > > ....
> > > end
> > > </pre>
>
> > > And this solved the problem.
>
> > > Hopefully that helps someone as this thread helped me.
>
> > > sg
>
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---