aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_assignment.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-211-9/+7
| | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* Alias `assign_attributes` to `attributes=` for `AttributeAssignment`Ryuta Kamizono2018-02-281-5/+0
| | | | There is no reason `attributes=` doesn't take `assign_attributes`.
* Don't include unused `ActiveSupport::Concern`Ryuta Kamizono2018-02-281-1/+0
| | | | This was added in 9bfa13b, but it is never used from the beginning.
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* No need to nodoc private methodsAkira Matsuda2016-12-241-1/+1
|
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-7/+7
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-53/+53
|
* applies new string literal convention in activerecord/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-1/+1
| | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* Addresses #23568Ryan T. Hosford2016-02-091-8/+0
| | | | | | | - Corrects an incorrect exception message when using accepts_nested_attributes_for - Removes rescue/reraise behavior introduced in #19077 - Adds has_many & has_one, nested_attributes test case specifying the message that should be conveyed with an exception raised because one of the nested attributes provided is unknown
* applies new doc guidelines to Active Record.Yves Senn2015-10-141-1/+1
| | | | | | | | | | | | | | | | | | | The focus of this change is to make the API more accessible. References to method and classes should be linked to make it easy to navigate around. This patch makes exzessiv use of `rdoc-ref:` to provide more readable docs. This makes it possible to document `ActiveRecord::Base#save` even though the method is within a separate module `ActiveRecord::Persistence`. The goal here is to bring the API closer to the actual code that you would write. This commit only deals with Active Record. The other gems will be updated accordingly but in different commits. The pass through Active Record is not completely finished yet. A follow up commit will change the spots I haven't yet had the time to update. /cc @fxn
* Add more detailed comment about _assign_attribute method [ci skip]Mehmet Emin İNAÇ2015-05-131-1/+2
| | | | fix minor problems
* Follow-up to #10776Robin Dupret2015-02-261-0/+7
| | | | | | | | | | The name `ActiveModel::AttributeAssignment::UnknownAttributeError` is too implementation specific so let's move the constant directly under the ActiveModel namespace. Also since this constant used to be under the ActiveRecord namespace, to make the upgrade path easier, let's avoid raising the former constant when we deal with this error on the Active Record side.
* Push multi-parameter assignement into the typesSean Griffin2015-02-071-96/+6
| | | | | | | | | | | | This allows us to remove `Type::Value#klass`, as it was only used for multi-parameter assignment to reach into the types internals. The relevant type objects now accept a hash in addition to their previous accepted arguments to `type_cast_from_user`. This required minor modifications to the tests, since previously they were relying on the fact that mulit-parameter assignement was reaching into the internals of time zone aware attributes. In reaility, changing those properties at runtime wouldn't change the accessor methods for all other forms of assignment.
* Move method to private sectionCarlos Antonio da Silva2015-01-261-7/+7
| | | | It's under private in Active Model as well.
* ✂️ and 💅 for #10776Sean Griffin2015-01-231-16/+4
| | | | | Minor style changes across the board. Changed an alias to an explicit method declaration, since the alias will not be documented otherwise.
* Extracted `ActiveRecord::AttributeAssignment` to ↵Bogdan Gusiev2015-01-231-38/+19
| | | | | | `ActiveModel::AttributesAssignment` Allows to use it for any object as an includable module.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* Silence warning in testSean Griffin2014-06-241-5/+5
| | | | | We still had one file using `column_for_attribute` when it could return nil, causing deprecation warnings in the tests.
* Remove unused param 'klass' from AttributeAssignment#read_otherMindaugas Mozūras2014-06-231-2/+2
|
* Remove composed_of special case from multi-parameter attributesSean Griffin2014-06-061-4/+3
| | | | | As we move towards removing the `klass` method from `column`, the else clause as it stands right now will become the only case.
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2014-06-011-2/+2
|\
| * [ci skip] add created_at and updated_at to exampleschneems2014-05-291-2/+2
| |
* | Remove :timestamp column typeSean Griffin2014-05-191-1/+1
|/ | | | | | | | | | | | The `:timestamp` type for columns is unused. All database adapters treat them as the same database type. All code in `ActiveRecord` which changes its behavior based on the column's type acts the same in both cases. However, when the type is passed to code that checks for the `:datetime` type, but not `:timestamp` (such as XML serialization), the result is unexpected behavior. Existing schema definitions will continue to work, and the `timestamp` type is transparently aliased to `datetime`.
* copy edits [ci skip]Vijay Dev2014-05-101-6/+5
|
* [ci skip] add example to AR#assign_attributesschneems2014-05-091-0/+10
|
* assign_attributes should return if argument is blank.wangjohn2013-09-241-0/+1
| | | | | | If you are passed an empty hash, then assign_attributes doesn't need to do any work and can just return early. This should fix the failing Agile Web Development tests.
* Merge pull request #9860 from wangjohn/update_attributes_throws_error_with_nilRafael Mendonça França2013-09-241-1/+3
|\ | | | | | | | | | | | | Raising an error when nil is passed to update_attributes. Conflicts: activerecord/CHANGELOG.md
| * Raising an error when nil or non-hash is passed to update_attributes.wangjohn2013-06-251-1/+3
| |
* | Remove deprecated attr_protected/accessibleŁukasz Strzałkowski2013-06-271-1/+0
|/ | | | Rails 4.0 has removed attr_protected and attr_accessible feature in favor of Strong Parameters.
* Add more data to AR::UnknownAttributeErrorBogdan Gusiev2013-05-161-1/+1
| | | | | | | | | begin Topic.new("hello" => "world") rescue ActiveRecord::UnknownAttributeError => e e.record # => #<Topic ... > e.attribute # => "hello" end
* require things we needAaron Patterson2013-05-151-0/+1
|
* Refactoring validate_missing_parameters to validate_required_parameters.wangjohn2013-03-231-5/+5
|
* 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
|