Hey All, I''m trying to do the basic test/unit stuff & having trouble w/a dynamic fixture error. I''m running rails 2.0.2 on windows. I have statuses & projects. Projects belong_to status and so forth. # statuses.yml ==================active: name: Active description: MyString # projects.yml ==================one: name: Center for Health Communications Research abbreviation: CHCR description: A collection of 3 projects. grant_number: 8 status_id: <%= statuses(:active).id %> start_date: 2008-03-20 end_date: 2008-03-20 ========================================= But when I run tests I get this for output: ========================================= 1) Error: test_truth(DomainTest): Fixture::FormatError: a YAML error occurred parsing C:/railsapps/collabtrac/test/fixtures/projects.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Please have a look at http://www.yaml.org/faq.html The exact error was: NoMethodError: undefined method `statuses'' for main:Object ========================================= Can someone tell me what I''m doing wrong here? Is the problem that projects.yml is getting read in before statuses.yml? If so, how do I control that load order? Thanks! -Roy Roy Pardee Research Analyst/Programmer Group Health Center For Health Studies (Cancer Research Network) (206) 287-2078 Google Talk: rpardee --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 26, 10:49 pm, "Pardee, Roy" <parde...-go57ItdSaco@public.gmane.org> wrote:> Hey All,> Can someone tell me what I''m doing wrong here? Is the problem that projects.yml is getting read in before statuses.yml? If so, how do I control that load order?That is correct and the statuses method probably isn''t even defined in the context you are using this in. The write way to do this is to put status: active in that fixture. As long as you have the status belongs_to association, rails will figure out that this means that you want the status_id column to have the value of the id of the status fixture with label ''active''. This won''t work if your fixture for statuses explicitly sets an id. 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sweetness--thanks! -Roy -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Frederick Cheung Sent: Thursday, November 27, 2008 4:59 AM To: Ruby on Rails: Talk Subject: [Rails] Re: error w/dynamic fixtures On Nov 26, 10:49 pm, "Pardee, Roy" <parde...-go57ItdSaco@public.gmane.org> wrote:> Hey All,> Can someone tell me what I''m doing wrong here? Is the problem that projects.yml is getting read in before statuses.yml? If so, how do I control that load order?That is correct and the statuses method probably isn''t even defined in the context you are using this in. The write way to do this is to put status: active in that fixture. As long as you have the status belongs_to association, rails will figure out that this means that you want the status_id column to have the value of the id of the status fixture with label ''active''. This won''t work if your fixture for statuses explicitly sets an id. 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---