aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/fixtures.rb
Commit message (Collapse)AuthorAgeFilesLines
* Improve the derivation of HABTM assocation join table namesAndrew White2012-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve the derivation of HABTM join table name to take account of nesting. It now takes the table names of the two models, sorts them lexically and then joins them, stripping any common prefix from the second table name. Some examples: Top level models (Category <=> Product) Old: categories_products New: categories_products Top level models with a global table_name_prefix (Category <=> Product) Old: site_categories_products New: site_categories_products Nested models in a module without a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: categories_products Nested models in a module with a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: admin_categories_products Nested models in a parent model (Catalog::Category <=> Catalog::Product) Old: categories_products New: catalog_categories_products Nested models in different parent models (Catalog::Category <=> Content::Page) Old: categories_pages New: catalog_categories_content_pages Also as part of this commit the validity checks for HABTM assocations have been moved to ActiveRecord::Reflection One side effect of this is to move when the exceptions are raised from the point of declaration to when the association is built. This is consistant with other association validity checks.
* Fix an error in example in methods of instanciated fixtures.Geoffrey Roguelon2012-05-151-1/+1
|
* Rename some variablesAlexey Muranov2012-05-091-76/+80
| | | | | | Rename some parameters and instance and local variables, mostly in fixtures.rb. Also remove an unused assignment to an instance variable. There are minor code changes.
* Remove unused private method in fixtures.rbAlexey Muranov2012-05-091-3/+0
| | | | Remove the unused private method ActiveRecord::Fixtures#yaml_fixtures_key(path).
* Remove unused parameter in ::instantiate_fixturesAlexey Muranov2012-05-091-5/+5
| | | | Second parameter of Fixtures::instantiate_fixtures was not used, so i removed it.
* Change unless + ! into ifPiotr Sarnacki2012-05-041-1/+1
|
* properly namespace the fixture exceptionAaron Patterson2012-03-221-6/+2
|
* Remove IdentityMapCarlos Antonio da Silva2012-03-131-3/+1
|
* Refactored the OrderedHash related stuffRaghunadh2012-02-091-2/+1
|
* Remove Array.wrap calls in ActiveRecordRafael Mendonça França2012-01-061-2/+1
|
* No need to require psych since require yaml does that.Rafael Mendonça França2012-01-041-1/+0
|
* No need to use rescue block to require psychRafael Mendonça França2012-01-041-6/+1
|
* create_fixtures should accept symbol keys for custom table -> class ↵Jeremy Kemper2012-01-031-2/+4
| | | | mappings. Fixes an unintended regression.
* use File.basename to get the filename minus .ymlAaron Patterson2012-01-031-2/+3
|
* setup_fixture_accessors should accept symbols for table names. Fixes an ↵Jeremy Kemper2012-01-031-0/+1
| | | | unintended (and untested) regression.
* Fixes for TestFixtures::setup_fixture_accessorsAlexey Muranov2011-12-301-6/+5
| | | | | | Renamed "fixture_name" to "accessor_name" and made fixture names in the form "admin/users" be used as the key for the hashes @fixture_cache and @loaded_fixtures. Previously the variable "fixture_name" here was getting a value of the form "admin_user", and this value was then used as the hash key.
* Fixture's table name be defined in the modelAlexey Muranov2011-12-301-10/+17
| | | | | | | | Made the fixture's table name be taken from its model class whenever this class responds to table_name, instead of inferring it sometimes from the fixture's pass. The previous behavior seemed buggy because it depended on whether the model class was passed as a constant or as a name string. Improved Fixtures#initialize.
* Use foo/bar instead of foo_bar keys for fixturesAlexey Muranov2011-12-301-12/+25
| | | | | | | | | | | | | This solves an issue with set_fixture_class class method caused by create_fixtures method's overwriting passed to it fixture model classes, when the fixtures are "namespased": foo/bar or admin/users. The idea is to use "foo/bar" string as the name and identifier of a fixture file bar in directory foo. The model class of the fixture is either set with set_fixture_class method, or otherwise inferred from its name using camelize method. Also a bug is fixed in lines 487-489 when the table names were guessed by substitution from the fixture file names, ambiguously called table_names, instead of being taken from fixture attributes. Now they are taken from attributes. I plan to submit another fix so that the fixture's table name (for example foo_bar) be defined by the fixture's model whenever possible, instead of inferring it from the fixture's name ("foo/bar").
* Use the correct table name from fixtureAlexey Muranov2011-12-281-2/+2
| | | | Fixed a bug in fixtures.rb where the table name was incorrectly inferred from the fixture path which was ambiguously called "table_name" but was also used as the fixture name. Now, the "correct" table name is taken from an instance variable.
* Fixtures support for ActiveRecord::ModelJon Leighton2011-12-241-1/+1
|
* * BufferedLogger is deprecated. Use ActiveSupport::Logger, or the loggerAaron Patterson2011-12-191-1/+0
| | | | from Ruby stdlib.
* ensure @fixture_connections is initialized in case an exception happens ↵Aaron Patterson2011-12-101-0/+1
| | | | during setup
* Errno::ENOENT error makes more sense when a file cannot be foundAaron Patterson2011-12-101-10/+0
|
* Transactional fixtures enlist all active database connections.Jeremy Kemper2011-10-051-6/+18
| | | | You can use multiple databases in your tests without disabling transactional fixtures.
* Revert "Raise error on unknown primary key."Jon Leighton2011-10-051-1/+1
| | | | This reverts commit ee2be435b1e5c0e94a4ee93a1a310e0471a77d07.
* Raise error on unknown primary key.Jon Leighton2011-10-051-1/+1
| | | | | If we don't have a primary key when we ask for it, it's better to fail fast. Fixes GH #2307.
* restores the API docs of AR::Fixtures, made a quick pass over them, revises ↵Xavier Noria2011-09-031-368/+361
| | | | link in fixture template [closes #2840]
* Improve examples: use each instead of for...inGabe Berke-Williams2011-08-311-1/+1
|
* find(:all) => allAkira Matsuda2011-07-081-3/+3
|
* Merge branch 'master' of github.com:rails/railsXavier Noria2011-05-251-4/+0
|\
| * removed deprecated methods, and related tests, from ActiveRecordJosh Kalderimis2011-05-251-4/+0
| |
* | Merge branch 'master' of git://github.com/lifo/docrailsXavier Noria2011-05-251-6/+6
|\ \ | |/ |/| | | | | | | Conflicts: actionmailer/lib/action_mailer/base.rb activesupport/lib/active_support/core_ext/kernel/requires.rb
| * Remove extra white spaces on ActiveRecord docs.Sebastian Martinez2011-05-231-6/+6
| |
* | properly reference yml alias nodesdmathieu2011-05-241-2/+2
| | | | | | | | as per the last version of the yml specifications : http://www.yaml.org/spec/1.2/spec.html#* alias//
* | removing CSV fixture supportAaron Patterson2011-05-231-52/+10
| |
* | use top level file constant for join, etcAaron Patterson2011-05-231-4/+4
| |
* | adding AR::Fixtures::File class to wrap a fixture fileAaron Patterson2011-05-231-0/+1
|/
* deprecating CSV fixture supportAaron Patterson2011-05-101-54/+2
|
* deprecating read_csv_fixture_files methodAaron Patterson2011-05-101-0/+2
|
* Added deprecation warning for Fixture(s) (Use ActiveRecord::Fixture(s))Jason Noble2011-05-071-0/+3
|
* Namespace Fixtures in ActiveRecordJason Noble2011-05-071-285/+287
| | | [Fixes #439]
* table name needs to be classified when instantiating fixturesAaron Patterson2011-04-291-2/+4
|
* s/ERb/ERB/gAkira Matsuda2011-04-031-3/+3
| | | | | The author of ERB sais, his eRuby implementation was originally named "ERb/ERbLight" and then renamed to "ERB" when started bundled as a Ruby standard lib. http://www2a.biglobe.ne.jp/~seki/ruby/erb.html
* Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-181-36/+36
|\ | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/association.rb activerecord/lib/active_record/fixtures.rb
| * fixture methods can be overridden and super() is usefulAaron Patterson2011-02-151-14/+17
| |
| * fixing variable names to reflect realityAaron Patterson2011-02-151-11/+11
| |
| * this is in the AR namespace, so AR must existAaron Patterson2011-02-151-1/+1
| |
| * fixing variable names, removing FixtureFile instances from test ivarsAaron Patterson2011-02-151-15/+14
| |
| * removing unused variableAaron Patterson2011-02-151-3/+1
| |
* | Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-151-141/+131
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/examples/performance.rb activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/nested_attributes.rb activerecord/test/cases/relations_test.rb