aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
Commit message (Collapse)AuthorAgeFilesLines
* Remove session_table_name method because this is global and used only once.kennyj2012-06-261-5/+1
|
* Add a description about ENV["SCOPE"]kennyj2012-06-261-1/+1
|
* Change the behavior of db:test:prepare task when schema_format is sql for ↵kennyj2012-06-261-1/+1
| | | | consistency.
* Change the behavior of db:test:clone task when schema_format is sql for ↵kennyj2012-06-261-1/+11
| | | | consistency.
* Change an order of methods for readbility.kennyj2012-06-261-7/+7
|
* Revert "Merge pull request #6344"Piotr Sarnacki2012-06-251-1/+1
| | | | | | | | | | | | | | This commit needs to be reverted because it introduces difficulties when using sqlite3 in development and other databases in production. This happens because when you create time column in sqlite3, it's dumped as datetime in schema.rb file. This reverts commit 57d534ee9e441d078fcc161c0c78ebaa5aacd736, reversing changes made to 20f049fb50daee0c5e5a69b55b529af5737e8e3f. Conflicts: activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb
* Stop assuming strings for grouped calculationsErnie Miller2012-06-241-6/+17
| | | | | | | | | | | | | | | Execute_grouped_calculation is one of those places where ActiveRecord forgets that it has ARel underpinnings, and assumes that the values provided to group_values are strings. This artificially hobbles otherwise functional code. This patch stops assuming that incoming values respond to to_sym, stops using string interpolation for table aliases on objects that support aliasing, and stops unnecessarily joining group_values on the relation. Additionally, it calls to_sql, if available, on objects sent to column_alias_for, in order to get a more reasonable alias string than a non-string's default to_str method.
* add :nodoc: to internal implementations [ci skip]Francesco Rodriguez2012-06-221-1/+1
|
* Allow precision option for postgresql datetimesTony Schneider2012-06-221-0/+10
| | | | | | | | | | This patch addresses the difficulty of retrieving datetime fields. By default, the database holds a higher precision than the time as a String. This issue is discussed at length at the following links: - [#3519](https://github.com/rails/rails/issues/3519) - [#3520](https://github.com/rails/rails/issues/3520) Also, kudos to @mattscilipoti
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-06-222-4/+16
|\
| * fixes a few mistakes in api docs [ci skip]Vijay Dev2012-06-221-4/+2
| |
| * Typo in documentation.Andrés Mejía2012-06-191-1/+1
| |
| * Add documentation for ActiveRecord::QueryMethods#reverse_order [ci skip]Florent Guilleux2012-06-161-0/+3
| |
| * Add documentation for ActiveRecord::QueryMethods#offset [ci skip]Ulises Cabanillas2012-06-161-0/+7
| |
| * Add documentation for ActiveRecord::QueryMethods#limit [ci skip]Florent Guilleux2012-06-161-3/+7
| |
* | Merge pull request #6800 from mschneider/dynamic_finders_for_aliased_attributesRafael Mendonça França2012-06-221-0/+1
|\ \ | | | | | | Dynamic finders for aliased attributes
| * | made dynamic finders alias_attribute awareMaximilian Schneider2012-06-221-0/+1
| | | | | | | | | | | | | | | previously dynamic finders only worked in combination with the actual column name and not its alias defined with #alias_attribute
* | | Add changelog entry and guide updates for pluck with multiple columnsCarlos Antonio da Silva2012-06-221-0/+1
| | |
* | | Refactor pluck with multiple columnsCarlos Antonio da Silva2012-06-221-26/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure it works with mix of symbols and strings, and with a select clause possibly containing more than one column. Also remove support for pluck with an array of columns, in favor of passing the list of attributes: Model.pluck(:a, :b) See comments: https://github.com/rails/rails/pull/6500#issuecomment-6030292
* | | ActiveRecord#pluck now accepts multiple columnsjeroeningen2012-06-221-15/+35
| | |
* | | Fix serializable_hash with xml generation and default :except optionCarlos Antonio da Silva2012-06-221-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When generating xml with a custom implementation of serializable_hash, if using the :except option, it was being overriden by the default AR implementation that attempts to ignore the inheritance column from STI automatically. So, if you have an implementation like this: def serializable_hash(options={}) super({ except: %w(some_attr) }.merge!(options)) end The :except option was correctly being used for :json generation, but not for :xml, because the options hash already contained the :except key with the inheritance column, thus overriding the customization. This commit fixes this problem by removing the :except logic from the xml serializer, that happened before calling serializable_hash. Since serializable_hash also does the same check for inheritance column, this logic was duplicated in both places, thus it's safe to remove it from xml serializer (see ActiveRecord::Serialization#serializable_hash). This is an attempt to solve issue #2498, that claims for a "Single transformation API for both xml and json representations".
* | | disallow mutating a relation once loadedJon Leighton2012-06-222-18/+23
| | |
* | | Improve the derivation of HABTM assocation join table namesAndrew White2012-06-226-34/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-201-2/+5
|/ /
* | Merge pull request #6798 from kennyj/db-rake-structure-loadCarlos Antonio da Silva2012-06-205-19/+26
|\ \ | | | | | | Refactor db:structure:load task.
| * | Refactor db:structure:load task.kennyj2012-06-215-19/+26
| | |
* | | Merge pull request #4396 from kennyj/fix_4259Rafael Mendonça França2012-06-201-4/+8
|\ \ \ | |/ / |/| | | | | 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-101-4/+8
| | | | | | | | | | | | 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-191-15/+19
| | | | | | | | | | | | Also use if/else block to not use short circuit return
* | | handle joins/includes correctly for pluck and calculation.Andrey Deryabin2012-06-191-1/+6
| | | | | | | | | | | | Fix #5990
* | | Refactor db:structure:dump task.kennyj2012-06-205-13/+41
| | |
* | | Refactor db:charset taskSimon Jefford2012-06-195-17/+25
| | | | | | | | | | | | | | | 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-191-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-181-3/+5
| | |
* | | Remember the stored attributes in a config attribute.Joost Baaij2012-06-181-0/+12
| | | | | | | | | | | | | | | | | | 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.
* | | 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
| | |
* | | Removing composed_of from ActiveRecord.Steve Klabnik2012-06-1810-343/+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
* | | Change minimum (default) log level in PostgreSQL to warning.kennyj2012-06-181-1/+1
| | |
* | | 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-181-2/+3
| | | |
* | | | 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-176-156/+268
|\ \ \ \ | | | | | | | | | | 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-172-15/+25
| | | | |