[typo] script/console and Typo (continuation from my last issue)

Scott Laird scott at sigkill.org
Wed Oct 19 09:00:17 EDT 2005


On Oct 19, 2005, at 4:35 AM, Trejkaz wrote:
>
> So I was ready to do a bit of digging to try figure out what might be
> happening with my sidebar.  I thought it might be neat to hammer  
> away at the
> console to get a closer look at what was happening.  But look!
>
>   % script/console
>   Loading development environment.
>
>>> Sidebar.find_all
>>>
>   NameError: uninitialized constant ApplicationController
>
> Why is this so?  With all the other rails apps I have hanging  
> around, I can
> access classes directly and it somehow finds them for me (either  
> that or it
> has them included already.)  Is Typo different like that?

The problem is that sidebars are a model that's full of controllers,  
which is sort of strange from a layering perspective.  The console  
automatically requires all of the models, but not the controllers.   
So you need to load them yourself.

> Anyway, I got a bit further after manually loading 'application'...
>
>   % script/console
>   Loading development environment.
>
>>> require 'application'
>>>
>   => true
>
>>> Sidebar.find_all[0].active_config
>>>
>   => "!map:HashWithIndifferentAccess \nmaximum_tags: \"1\"\n"
>
> So at this point I don't know _why_ it's a string, but I know that  
> it _is_.
> My guess is that the same problem is causing both these phenomena.   
> Luckily I
> do keep my production and development check-outs separate, so the  
> production
> one is sitting happily at revision 646 with no problems at all.

Oh, this one.

You're using Ruby 1.8.3.  For some reason, it doesn't always  
deserialize YAML right with Rails 0.13.1.  No idea why.


Scott


More information about the Typo-list mailing list