aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
* Improve the derivation of HABTM assocation join table namesAndrew White2012-06-2213-52/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Set the hash value directly instead of using merge!Carlos Antonio da Silva2012-06-211-1/+1
|
* changed the firm of changes_from_zero_to_string?Angelo capilleri2012-06-211-2/+2
| | | | delete *column* because is unused by the method.
* explain listener does not care about time, so use evented listenerAaron Patterson2012-06-202-7/+10
|
* Refactor testcase codes. It's repeated.kennyj2012-06-211-132/+38
|
* Merge pull request #6798 from kennyj/db-rake-structure-loadCarlos Antonio da Silva2012-06-209-53/+133
|\ | | | | Refactor db:structure:load task.
| * Remove duplicated codes.kennyj2012-06-211-41/+11
| |
| * Refactor db:structure:load task.kennyj2012-06-219-19/+129
| |
* | Merge pull request #4396 from kennyj/fix_4259Rafael Mendonça França2012-06-202-4/+40
|\ \ | |/ |/| | | Fix GH #4259. When we execute schema dumper, we must remove table_name_prefix and table_name_suffix.
| * Fix GH #4259. We must remove table_name_prefix and table_name_suffix, when ↵kennyj2012-01-102-4/+40
| | | | | | | | we execute schema dumper.
* | Remove unneeded code since pluck is respecting joins nowRafael Mendonça França2012-06-191-12/+1
| |
* | Extract conditional to a method to avoid duplicationRafael Mendonça França2012-06-192-15/+22
| | | | | | | | Also use if/else block to not use short circuit return
* | handle joins/includes correctly for pluck and calculation.Andrey Deryabin2012-06-192-1/+49
| | | | | | | | Fix #5990
* | Merge pull request #6782 from kennyj/db-rake-structure-dumpRafael Mendonça França2012-06-199-14/+147
|\ \ | | | | | | Refactor db:structure:dump task.
| * | Refactor db:structure:dump task.kennyj2012-06-209-14/+147
| | |
* | | Merge pull request #6785 from kennyj/rename_testcase_nameCarlos Antonio da Silva2012-06-191-1/+1
|\ \ \ | | | | | | | | Rename testcase name. It's wrong in the context.
| * | | Rename testcase name. It's wrong in the context.kennyj2012-06-201-1/+1
| |/ /
* / / Rename MySQLTestPurge to MySQLPurgeTest for consistency.kennyj2012-06-201-1/+1
|/ /
* | Refactor db:charset taskSimon Jefford2012-06-199-20/+118
| | | | | | | | | | In a similar vein to Pat's work on create, drop etc, the db:charset task is now a one liner in databases.rake
* | Refactor the conditionalsRafael Mendonça França2012-06-191-7/+7
| |
* | Validates_numericality_of is skipped when changing 0 to to non-empty stringAngelo capilleri2012-06-192-5/+25
| | | | | | | | | | | | | | | | | | | | This happens when A has_many many B and A accepts_nested_attributes B that has a numeric colum with initial 0 value. So a.update_attributes({:b_attributes => { :id => b.id, :numeric => 'foo' }}) passes the validation test but, the value of :numeric doesn't change. his commit forces that the update fails with the above conditions. Fixes #6393 Fixes #2331
* | Refactor and use class_attributeCarlos Antonio da Silva2012-06-182-7/+15
| |
* | Remember the stored attributes in a config attribute.Joost Baaij2012-06-183-1/+23
| | | | | | | | | | | | This allows you to retrieve the list of attributes you've defined. Usable for e.g. selects in the view, or interators based on the attributes you wish to store in the serialized column.
* | Improve the CHANGELOG entry [ci skip]Rafael Mendonça França2012-06-181-2/+19
| |
* | Refactor Relation#update a bit to avoid an extra Enumerator instanceCarlos Antonio da Silva2012-06-181-1/+1
| |
* | Make DatabaseTasks a module with real private methodsCarlos Antonio da Silva2012-06-181-13/+14
| |
* | Add CHANGELOG entry to composed_of removalRafael Mendonça França2012-06-181-0/+6
| |
* | Merge pull request #6743 from steveklabnik/remove_composed_ofRafael Mendonça França2012-06-1818-768/+9
|\ \ | | | | | | | | | Removing composed_of
| * | Removing composed_of from ActiveRecord.Steve Klabnik2012-06-1818-768/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature adds a lot of complication to ActiveRecord for dubious value. Let's talk about what it does currently: class Customer < ActiveRecord::Base composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) end Instead, you can do something like this: def balance @balance ||= Money.new(value, currency) end def balance=(balance) self[:value] = balance.value self[:currency] = balance.currency @balance = balance end Since that's fairly easy code to write, and doesn't need anything extra from the framework, if you use composed_of today, you'll have to add accessors/mutators like that. Closes #1436 Closes #2084 Closes #3807
* | | Add ensure Joke.reset_sequence_nameYasuo Honda2012-06-191-0/+2
|/ / | | | | | | | | to avoid ORA-02289: sequence does not exist for `SELECT "BLACK_JOKES_SEQ".NEXTVAL FROM dual`
* | Change minimum (default) log level in PostgreSQL to warning.kennyj2012-06-183-1/+11
| |
* | Merge branch 'dp_docs'Carlos Antonio da Silva2012-06-181-0/+92
|\ \ | | | | | | | | | Closes #6697
| * | Documentation for where and where! methods on relations.David Paschich2012-06-181-0/+92
| | | | | | | | | | | | Based on examples seen in the Rails test suite. [ci skip]
* | | fix invalid syntax and sqlite rake failing testsFrancesco Rodriguez2012-06-184-6/+9
| | |
* | | add :nodoc: to AR::Tasks and update to follow the coding conventionsFrancesco Rodriguez2012-06-184-208/+226
| | |
* | | check if sqlite3 file exists before removeFrancesco Rodriguez2012-06-181-3/+3
| | |
* | | Merge pull request #6761 from freelancing-god/db-rakeJon Leighton2012-06-1710-156/+983
|\ \ \ | | | | | | | | Get logic out of db rake tasks, and into classes and objects
| * | | Rails is the default (but now override able) source for environment and path.Pat Allan2012-06-174-43/+57
| | | |
| * | | Cleaning up after some warnings, adding slightly higher-level tests.Pat Allan2012-06-176-9/+309
| | | |
| * | | One line db:create/db:drop tasks.Pat Allan2012-06-172-55/+50
| | | | | | | | | | | | | | | | | | | | | | | | Now isn't that better? And yes, I know that private has no impact on class methods - it's a visual distinction, not a technical one.
| * | | db:drop and some of db:test:purge.Pat Allan2012-06-178-52/+243
| | | |
| * | | db:create for PostgreSQL pulled out into a class.Pat Allan2012-06-176-36/+99
| | | |
| * | | db:create for MySQL now much cleaner.Pat Allan2012-06-176-37/+230
| | | |
| * | | Confirm connection is not established if file exists.Pat Allan2012-06-171-1/+10
| | | |
| * | | A beginning of sorts.Pat Allan2012-06-174-12/+74
| | | | | | | | | | | | | | | | Minimal implementation that supports db:create SQLite replacement
* | | | Merge pull request #6759 from dylanahsmith/only-catch-standard-errorSantiago Pastorino2012-06-173-6/+6
|\ \ \ \ | | | | | | | | | | Avoid unnecessary catching of Exception instead of StandardError.
| * | | | Avoid unnecessary catching of Exception instead of StandardError.Dylan Smith2012-06-173-6/+6
| | | | |
* | | | | Adding `load_config` task as dependency.Cairo Noleto2012-06-161-14/+14
|/ / / / | | | | | | | | | | | | Without this, some tasks won't load configurations like custom engines.
* | | | Don't read csv file during executing db:fixtures:load.kennyj2012-06-171-1/+1
| | | |
* | | | no need to define methods in included hookJon Leighton2012-06-151-13/+13
| | | |