Fred, thank you very much.  This was exactly the problem.  But I admit
that I'm still confused.  Everything was created with the "generate"
script which presumably uses the same rules.  And when I go into the
ruby console:

Loading development environment (Rails 2.2.2)
>> "cache".pluralize
=> "caches"

So it seems to get this correct even without the initializer.  How did
it get it wrong when looking for the model class?

On May 9, 3:04 pm, Frederick Cheung <[email protected]>
wrote:
> On May 9, 6:33 pm, Brian <[email protected]> wrote:
>
> > On May 9, 1:18 pm, Frederick Cheung <[email protected]>
> > wrote:
>
> > > Does removing the structure: line make a difference ?
>
> > > Fred
>
> > It does, but then I get similar errors loading other fixtures.  Right
> > now, my cache fixture only has the two entries generated when I
> > created the model, but I'd like to add more meaningful test data in
> > there to start writing my unit tests.  References to structures will
> > be fairly important.
>
> ah, I know what's happening. The default pluralization rules rails has
> screw up cache/caches, so when rails loads the fixtures it tries to
> look for the wrong model class so the fixture data is inserted without
> the structure having being turned into structure_id
> Adding an inflector rule should do the trick eg stick
>
> ActiveSupport::Inflector.inflections do |inflect|
>    inflect.irregular 'cache', 'caches'
> end
>
> in an initializer.
>
> Fred
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to