Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | Roflscaling! | Jon Leighton | 2011-12-01 | 2 | -11/+8 | |
| | | | | | Don't prefix the name with attribute_. Avoids a string allocation on read_attribute, which is a bit faster. | |||||
* | Create method with known identifier then alias into place. | Jon Leighton | 2011-12-01 | 1 | -25/+21 | |
| | | | | | | | | This means we never have to rely on define_method (which is slower and uses more memory), even when we have attributes containing characters that are not allowed in standard method names. (I am mainly changing this because the duplication annoys me, though.) | |||||
* | Remove some unnecessary code etc | Jon Leighton | 2011-12-01 | 2 | -26/+11 | |
| | ||||||
* | Add test for read_attribute(:id) with non-standard PK. | Jon Leighton | 2011-12-01 | 2 | -4/+18 | |
| | | | | | | | | Also make it actually work. It slows down all read_attribute accesses to map 'id' to whatever the PK actually is, inside read_attribute. So instead make sure the necessary methods are defined and that they redirect wherever they need to go. | |||||
* | Remove the need for type_cast_attribute. | Jon Leighton | 2011-12-01 | 3 | -42/+47 | |
| | | | | This is good because it reduces duplication. | |||||
* | Get rid of the underscore versions of attribute methods! | Jon Leighton | 2011-12-01 | 3 | -6/+33 | |
| | | | | This makes me happy! | |||||
* | Don't rely on underscore-prefixed attribute methods. | Jon Leighton | 2011-12-01 | 3 | -48/+80 | |
| | | | | | | Define singleton methods on the attributes module instead. This reduces method pollution on the actual model classes. It also seems to make something faster, I am unsure why! O_o | |||||
* | If the table behind has no primary key, do not ask again and just return nil. | Julius de Bruijn | 2011-11-30 | 1 | -1/+2 | |
| | ||||||
* | consistency | Jon Leighton | 2011-11-30 | 3 | -16/+16 | |
| | ||||||
* | Don't check column type, you might implement a custom coder that serializes ↵ | Jon Leighton | 2011-11-30 | 1 | -1/+1 | |
| | | | | to a different type | |||||
* | omg computer science! | Jon Leighton | 2011-11-30 | 2 | -22/+44 | |
| | | | | | | | Implement a mini state machine for serialized attributes. This means we do not have to deserialize the values upon initialization, which means that if we never actually access the attribute, we never have to deserialize it. | |||||
* | Don't need second param | Jon Leighton | 2011-11-30 | 2 | -4/+4 | |
| | ||||||
* | No longer need to undef id as we are defining it ourselves | Jon Leighton | 2011-11-30 | 1 | -3/+0 | |
| | ||||||
* | Move some serialization stuff out of Base | Jon Leighton | 2011-11-30 | 1 | -0/+42 | |
| | ||||||
* | Extract attribute serialization code into a separate module | Jon Leighton | 2011-11-30 | 2 | -28/+47 | |
| | ||||||
* | Use inheritance to avoid special-case code for the 'id' method | Jon Leighton | 2011-11-30 | 3 | -8/+20 | |
| | ||||||
* | #id is an alias for whatever the primary key is | Jon Leighton | 2011-11-30 | 1 | -1/+1 | |
| | ||||||
* | fix indent | Jon Leighton | 2011-11-30 | 1 | -3/+3 | |
| | ||||||
* | Deprecate set_primary_key in favour of self.primary_key= | Jon Leighton | 2011-11-29 | 1 | -20/+26 | |
| | ||||||
* | Speed up attribute invocation by checking if both name and calls are compilable. | José Valim | 2011-11-14 | 2 | -2/+2 | |
| | ||||||
* | Revert "Raise error on unknown primary key." | Jon Leighton | 2011-10-05 | 3 | -11/+4 | |
| | | | | This reverts commit ee2be435b1e5c0e94a4ee93a1a310e0471a77d07. | |||||
* | Raise error on unknown primary key. | Jon Leighton | 2011-10-05 | 3 | -4/+11 | |
| | | | | | If we don't have a primary key when we ask for it, it's better to fail fast. Fixes GH #2307. | |||||
* | Don't require a DB connection when setting primary key. | Jon Leighton | 2011-09-26 | 1 | -1/+0 | |
| | | | | Closes #2807. | |||||
* | Raise error when using write_attribute with a non-existent attribute. | Jon Leighton | 2011-09-13 | 1 | -3/+7 | |
| | | | | | | | | | Previously we would just silently write the attribute. This can lead to subtle bugs (for example, see the change in AutosaveAssociation where a through association would wrongly gain an attribute. Also, ensuring that we never gain any new attributes after initialization will allow me to reduce our dependence on method_missing. | |||||
* | Add deprecation for doing `attribute_method_suffix ''` | Jon Leighton | 2011-09-13 | 1 | -2/+0 | |
| | ||||||
* | Alias id= if necessary, rather than relying on method_missing | Jon Leighton | 2011-09-13 | 1 | -0/+4 | |
| | ||||||
* | Revert "to_key on a destroyed model should return nil". Closes #2440 | Santiago Pastorino | 2011-08-05 | 1 | -3/+2 | |
| | | | | This reverts commit c5448721b5054b8a467958d60427fdee15eac604. | |||||
* | to_key on a destroyed model should return nil | Santiago Pastorino | 2011-07-09 | 1 | -1/+1 | |
| | ||||||
* | only calculate method name once | Aaron Patterson | 2011-06-30 | 1 | -2/+3 | |
| | ||||||
* | Remove trailing white-spaces | Guillermo Iguaran | 2011-06-05 | 1 | -1/+1 | |
| | ||||||
* | Remove extra white spaces on ActiveRecord docs. | Sebastian Martinez | 2011-05-23 | 1 | -1/+1 | |
| | ||||||
* | Avoid define_method if possible. | José Valim | 2011-04-19 | 2 | -2/+2 | |
| | ||||||
* | Return nil from read_attribute(:foo) if 'foo' is not present in the ↵ | Jon Leighton | 2011-04-15 | 1 | -1/+1 | |
| | | | | @attributes hash, but the _foo method has been defined. This brings the behaviour into line with the 3-0-stable branch and the master branch before 93641ed6c8c684f6b4db02b6c8a22fa9bc7f0eaf (there were previously no assertions about this which is why the change slipped through). Note that actually calling the 'foo' method will still raise an error if the attribute is not present. | |||||
* | Undo performances regressions I introduced in ↵ | Jon Leighton | 2011-04-15 | 1 | -5/+23 | |
| | | | | bbe0a507f287c20ab4ae8a244fbfc810665deda5 and add test for an edge case. Add comments to explain the intent of the code. | |||||
* | Remove unnecessary code from define_read_method and add assertion to make ↵ | Jon Leighton | 2011-04-15 | 1 | -7/+4 | |
| | | | | sure the underscored version is actually generated | |||||
* | Fixes performance issue introduced in 3.0.6 (issue #6695) | Stian Grytøyr | 2011-04-14 | 1 | -3/+5 | |
| | ||||||
* | Remove `#among?` from Active Support | Prem Sichanugrist | 2011-04-13 | 1 | -1/+1 | |
| | | | | | | After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now. It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`. | |||||
* | Change Object#either? to Object#among? -- thanks to @jamesarosen for the ↵ | David Heinemeier Hansson | 2011-04-12 | 1 | -1/+1 | |
| | | | | suggestion! | |||||
* | Using Object#in? and Object#either? in various places | Prem Sichanugrist | 2011-04-11 | 1 | -1/+2 | |
| | | | | There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?. | |||||
* | Quote find_in_batches ORDER BY clause [#6620 state:resolved] | Andrew White | 2011-03-29 | 1 | -1/+12 | |
| | ||||||
* | Added new #update_column method. | Sebastian Martinez | 2011-03-27 | 1 | -0/+1 | |
| | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> | |||||
* | Fix before_type_cast for timezone aware attributes by caching converted ↵ | Adam Meehan | 2011-03-23 | 1 | -4/+5 | |
| | | | | value on write. Also remove read method reload arg on timezone attributes. | |||||
* | use class_eval with a string when it's possible | Santiago Pastorino | 2011-03-22 | 2 | -5/+13 | |
| | ||||||
* | Allow to read and write AR attributes with non valid identifiers | Santiago Pastorino | 2011-03-22 | 2 | -2/+7 | |
| | ||||||
* | Merge remote branch 'rails/master' into identity_map | Emilio Tagua | 2011-02-15 | 3 | -26/+37 | |
|\ | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/examples/performance.rb activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/nested_attributes.rb activerecord/test/cases/relations_test.rb | |||||
| * | primary keys should not be cleared on cache clear, fixing oracle tests | Aaron Patterson | 2011-02-08 | 1 | -0/+1 | |
| | | ||||||
| * | avoid nil.dup | Akira Matsuda | 2011-02-07 | 1 | -1/+1 | |
| | | | | | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com> | |||||
| * | make sure de-serialization happens on object instantiation | Aaron Patterson | 2011-02-01 | 2 | -3/+2 | |
| | | ||||||
| * | store the serialized column values in the @attributes hash | Aaron Patterson | 2011-02-01 | 1 | -1/+2 | |
| | | ||||||
| * | move the coders to the serialized_attributes hash | Aaron Patterson | 2011-02-01 | 1 | -7/+3 | |
| | |