Alexey Muranov
2011-Dec-25 12:24 UTC
Fixtures vs Fixture class, what is the intended purpose?
Hello, i am trying to fix the code for fixtures in rails because it is buggy and internal variable names are confusing, could somebody please explain to me what is the intended purpose of Fixture and Fixtures classes respectively? For example, why do we need both `Fixtures.initialize`and `Fixture.initialize`? They both "initialize" a single fixture, and in fact `Fixture.initialize` does nothing but set up two instance variables, and it is not called anywhere in fixtures.rb. (Maybe i''ll try to remove it and run tests, to see what happens.) I am also considering to propose changing some fixtures API, like to make the (undocumented?) class attribute `TestFixtures::fixture_table_names` to hold a Hash of `"fixture_name" => :table_name`, similarly to `TestFixtures::fixture_class_names` holding the Hash of `"fixture_name" => FixtureModelClass` (i would also propose to rename). Currently `TestFixtures::fixture_table_names` holds an Array. I am also trying to fix the meaning of `fixture_name`, which before was sometimes used interchangeably with `table_name`: i want it to be in the form `"admin/users"` instead of `:admin_users`, like the form in which `fixtures` method accepts them. So before making changes, i would like to understand what the classes Fixtures, Fixture, TestFixtures, are exactly supposed to do, and why to have so many. What is `Fixture.initialize` for? Alexey. -- Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Alexey Muranov
2011-Dec-27 10:13 UTC
Re: Fixtures vs Fixture class, what is the intended purpose?
I''ve figured out that `Fixture` is for a single row. -- Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.