aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
Commit message (Collapse)AuthorAgeFilesLines
* Fix the build on postgres. Note: we should probably actually make schema ↵Jon Leighton2011-12-161-1/+1
| | | | mutations bust the cache.
* Don't store defaults in the schema cacheJon Leighton2011-12-161-2/+2
|
* Cache columns at the model level.Jon Leighton2011-12-161-2/+0
| | | | Allows two models to use the same table but have different primary keys.
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-0/+12
|
* Fix #3987.Jon Leighton2011-12-151-0/+2
|
* Stop the build asploding on 1.8.7Jon Leighton2011-12-141-0/+2
|
* Use a separate module for 'external' attribute methods.Jon Leighton2011-12-142-17/+12
|
* use the schema cache when asking for the primary keyAaron Patterson2011-12-121-1/+1
|
* fixing eval'd line numbers.Aaron Patterson2011-12-081-2/+2
|
* Fix #3837.Jon Leighton2011-12-031-11/+5
| | | | | We also need to time zone convert time zone aware attributes when accessed via read_attribute, not only when via direct access.
* Revert "Roflscaling!" (for now)Jon Leighton2011-12-022-8/+11
| | | | | | | | This reverts commit f6b5046305d43c5f64bcb6fed0e44f7bca99a603. Fear not, the roflscale will return when I have a bit more time and figure out a better way to do it. (In particular, a way that doesn't break the build.)
* Fewer string allocations in attribute methodJon Leighton2011-12-011-4/+4
|
* Roflscaling!Jon Leighton2011-12-012-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 Leighton2011-12-011-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 etcJon Leighton2011-12-012-26/+11
|
* Add test for read_attribute(:id) with non-standard PK.Jon Leighton2011-12-012-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 Leighton2011-12-013-42/+47
| | | | This is good because it reduces duplication.
* Get rid of the underscore versions of attribute methods!Jon Leighton2011-12-013-6/+33
| | | | This makes me happy!
* Don't rely on underscore-prefixed attribute methods.Jon Leighton2011-12-013-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 Bruijn2011-11-301-1/+2
|
* consistencyJon Leighton2011-11-303-16/+16
|
* Don't check column type, you might implement a custom coder that serializes ↵Jon Leighton2011-11-301-1/+1
| | | | to a different type
* omg computer science!Jon Leighton2011-11-302-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 paramJon Leighton2011-11-302-4/+4
|
* No longer need to undef id as we are defining it ourselvesJon Leighton2011-11-301-3/+0
|
* Move some serialization stuff out of BaseJon Leighton2011-11-301-0/+42
|
* Extract attribute serialization code into a separate moduleJon Leighton2011-11-302-28/+47
|
* Use inheritance to avoid special-case code for the 'id' methodJon Leighton2011-11-303-8/+20
|
* #id is an alias for whatever the primary key isJon Leighton2011-11-301-1/+1
|
* fix indentJon Leighton2011-11-301-3/+3
|
* Deprecate set_primary_key in favour of self.primary_key=Jon Leighton2011-11-291-20/+26
|
* Speed up attribute invocation by checking if both name and calls are compilable.José Valim2011-11-142-2/+2
|
* Revert "Raise error on unknown primary key."Jon Leighton2011-10-053-11/+4
| | | | This reverts commit ee2be435b1e5c0e94a4ee93a1a310e0471a77d07.
* Raise error on unknown primary key.Jon Leighton2011-10-053-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 Leighton2011-09-261-1/+0
| | | | Closes #2807.
* Raise error when using write_attribute with a non-existent attribute.Jon Leighton2011-09-131-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 Leighton2011-09-131-2/+0
|
* Alias id= if necessary, rather than relying on method_missingJon Leighton2011-09-131-0/+4
|
* Revert "to_key on a destroyed model should return nil". Closes #2440Santiago Pastorino2011-08-051-3/+2
| | | | This reverts commit c5448721b5054b8a467958d60427fdee15eac604.
* to_key on a destroyed model should return nilSantiago Pastorino2011-07-091-1/+1
|
* only calculate method name onceAaron Patterson2011-06-301-2/+3
|
* Remove trailing white-spacesGuillermo Iguaran2011-06-051-1/+1
|
* Remove extra white spaces on ActiveRecord docs.Sebastian Martinez2011-05-231-1/+1
|
* Avoid define_method if possible.José Valim2011-04-192-2/+2
|
* Return nil from read_attribute(:foo) if 'foo' is not present in the ↵Jon Leighton2011-04-151-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 Leighton2011-04-151-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 Leighton2011-04-151-7/+4
| | | | sure the underscored version is actually generated
* Fixes performance issue introduced in 3.0.6 (issue #6695)Stian Grytøyr2011-04-141-3/+5
|
* Remove `#among?` from Active SupportPrem Sichanugrist2011-04-131-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 Hansson2011-04-121-1/+1
| | | | suggestion!