1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

17 commits

Author SHA1 Message Date
Vinicius Stock
2e9e940e22
Change safe guard to check for each_pair instead of stringify_keys 2020-02-07 11:36:35 -05:00
Vinicius Stock
112c3ec0f5
Only dup attributes in activerecord attribute_assignment 2020-02-06 17:02:56 -05:00
Vinicius Stock
8b59960cd4
Do not stringify attributes in assign_attributes 2020-02-06 16:27:24 -05:00
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
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.
2019-06-13 12:00:45 +09:00
Semyon Pupkov
2253f6cca1 Improve error message when assign wrong attributes to model 2018-04-28 16:27:16 +05:00
Ryuta Kamizono
42a16a4d65 Alias assign_attributes to attributes= for AttributeAssignment
There is no reason `attributes=` doesn't take `assign_attributes`.
2018-02-28 19:58:45 +09:00
shotat
b2999d631f add frozen string literal comment 2017-06-15 11:45:15 +09:00
shotat
2396f79fec freeze string 2017-06-14 17:49:54 +09:00
shotat
285cba022c enhance active model assignment 2017-06-14 10:31:12 +09:00
Viktor Fonic
ea2850b96a Docs: Fix output representation [ci skip]
The output of two string attributes is displayed differently in the docs. Standardize the output by always showing it as a comment.
2017-05-31 10:21:51 +08:00
Tsukuru Tanimichi
d1ca18d21f No need to check nil
```ruby
nil.respond_to?(:stringify_keys) # => false
```

```ruby
include ActiveModel::AttributeAssignment
Object.new.assign_attributes(nil) #  => ArgumentError: When assigning attributes, you must pass a hash as an argument.
```
2017-04-02 13:42:14 +09:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
18a2513729 applies new string literal convention in activemodel/lib
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:38:02 +02:00
Thomas Walpole
85f7d955f3 Update and fix forbidden attributes tests
Add AC::Parameters tests for WhereChain#not
2015-11-03 11:34:07 -08:00
Robin Dupret
95c2fc9679 Follow-up to #10776
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.
2015-02-26 15:40:03 +01:00
Sean Griffin
a225d4bec5 ✂️ and 💅 for #10776
Minor style changes across the board. Changed an alias to an explicit
method declaration, since the alias will not be documented otherwise.
2015-01-23 14:51:59 -07:00
Bogdan Gusiev
2606fb3397 Extracted ActiveRecord::AttributeAssignment to ActiveModel::AttributesAssignment
Allows to use it for any object as an includable module.
2015-01-23 23:43:22 +02:00