aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_assignment.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate obsolete Time to DateTime fallback methodsAndrew White2012-12-111-1/+1
| | | | | | | The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time methods were added to handle the limitations of Ruby's native Time implementation. Those limitations no longer apply so we are deprecating them in 4.0 and they will be removed in 4.1.
* Typecast to string and array are not supported in multiparameterRafael Mendonça França2012-10-181-3/+2
| | | | attributes
* update AR::AttributeAssignment documentation [ci skip]Francesco Rodriguez2012-09-191-5/+5
|
* AR::Base#attributes= is just an alias for AR::Base#assign_attributesGuillermo Iguaran2012-09-191-10/+4
|
* Remove mass_assignment_options from ActiveRecordGuillermo Iguaran2012-09-161-17/+2
|
* attr_accessible and attr_protected raise an exception pointing to use plugin ↵Guillermo Iguaran2012-09-161-0/+2
| | | | or new protection model
* Rename ForbiddenAttributes exception to ForbiddenAttributesErrorGuillermo Iguaran2012-09-161-1/+1
|
* Remove mass assignment security from ActiveRecordGuillermo Iguaran2012-09-161-73/+8
|
* Get rid of some arguments by using the accessorsCarlos Antonio da Silva2012-08-181-30/+31
| | | | | Cleans up a lot of noise from arguments being passed from one method to another.
* Move multiparameter attribute logic to a classCarlos Antonio da Silva2012-08-181-72/+84
| | | | | This should make it easier to refactor and improve this code, and remove complexity with params going around here and there.
* Some more cleanup to use Hash#values_at, and some method docsCarlos Antonio da Silva2012-08-181-3/+7
|
* Use cached column information to instantiate time objectCarlos Antonio da Silva2012-08-181-6/+6
|
* Refactor blank date parameter validationCarlos Antonio da Silva2012-08-181-2/+6
|
* Refactor missing parameter validation based on positionCarlos Antonio da Silva2012-08-181-7/+12
|
* Reuse already fetched column to check for :timeCarlos Antonio da Silva2012-08-181-5/+6
| | | | | Avoid doing a new column lookup for the attribute, since we already have the column to check for the klass.
* Refactor some code in multiparameter assignmentCarlos Antonio da Silva2012-08-181-26/+25
| | | | | Move some methods to the top to better organize them, since they're used right at the beginning of the multiparameter assignment method chain.
* Extract nested parameter assignment to a separate methodCarlos Antonio da Silva2012-08-181-3/+6
|
* don't call method unless we need toJon Leighton2012-08-171-1/+1
|
* align them assignmentsJon Leighton2012-08-171-4/+4
|
* Optimize for the happy pathJon Leighton2012-08-171-11/+14
| | | | | | Checking respond_to? incurs overhead, and most of the time when assigning attributes it will return true. So just handle the NoMethodError instead.
* load active_support/concern in active_support/railsXavier Noria2012-08-021-1/+0
|
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-271-2/+2
| | | | | | | | | | | This reverts commit 14fc8b34521f8354a17e50cd11fa3f809e423592. Reason: we need to discuss a better path from this removal. Conflicts: activerecord/lib/active_record/reflection.rb activerecord/test/cases/base_test.rb activerecord/test/models/developer.rb
* Fixes #6825, adds tests covering cases and error possibilities, also changes ↵Mauricio Linhares2012-06-271-9/+22
| | | | SQLite3 driver to correctly generate a time column instead of datetime
* Removing composed_of from ActiveRecord.Steve Klabnik2012-06-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix deprecation warnings when using ↵Jon Leighton2012-06-151-3/+8
| | | | config.active_record.mass_assignment_sanitizer=
* Fix observers with AR::ModelJon Leighton2012-06-151-0/+1
|
* Fix config.active_record.whitelist_attributes with AR::ModelJon Leighton2012-06-151-0/+13
|
* Merge pull request #6676 from aurelian/masterRafael Mendonça França2012-06-121-1/+1
|\ | | | | Don't assign the attributes if the list is empty
| * Don't assign the attributes if the list is empty.Aurelian Oancea2012-06-081-1/+1
| |
* | Ensure that mass assignment options are preservedAndrew White2012-06-101-1/+3
|/ | | | | | | | | | | | | | | | There are two possible scenarios where the @mass_assignment_options instance variable can become corrupted: 1. If the assign_attributes doesn't complete correctly, then subsequent calls to a nested attribute assignment method will use whatever options were passed to the previous assign_attributes call. 2. With nested assign_attributes calls, the inner call will overwrite the current options. This will only affect nested attributes as the attribute hash is sanitized before any methods are called. To fix this we save the current options in a local variable and then restore these options in an ensure block.
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-0/+221