On Mar 14, 8:30 pm, Carlos Santana <[email protected]>
wrote:
> MaD wrote:
> > UnassignedUser gets only loaded when User is loaded. put it in its own
> > file and maybe add:
> > self.abstract_class = true
>
> Separate file in the model directory?
>
Yes. The think to understand is that if your app hits the constant
Foo, rails will try and load foo.rb hoping that it defines Foo. If
there is no such foo.rb because Foo is in fact declared in bar.rb then
this don't work.
You need to either put things where rails will find them automatically
or explicitly require them (using require_dependency)
Fred
> My objective is to avoid nil object errors when no user is logged in -
> i.e. when session[:user] is nil.
>
> However, I still need to call some instance methods on this object.
>
> Please suggest me how can I do this?
>
>
>
> > other than that you can load it whenever you want via include or
> > require.
>
> --
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---