aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove duplicated `require 'arel'`Ryuta Kamizono2016-02-061-1/+0
| | | | It appears first in `lib/active_record.rb`.
* Don't recommend using `ActiveRecord::Base[]`Sean Griffin2016-01-291-3/+0
| | | These methods are more expensive than the alternatives, and have strange semantics that are likely undesirable.
* fix typo in method name [ci skip]yuuji.yaginuma2015-12-171-1/+1
| | | | It was changed by mistake at 428d47adfed8d6aa7b21aec2bf5ad890961c9de3
* applies new doc guidelines to Active Record.Yves Senn2015-10-141-15/+24
| | | | | | | | | | | | | | | | | | | 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
* remove unused require ‘set’NehaGautam2015-08-251-1/+0
|
* Add #cache_key to ActiveRecord::Relation.Alberto F. Capel2015-07-201-0/+1
|
* Remove `.superclass_delegating_accessor`. Refer #14271Akshay Vishnoi2015-05-241-1/+0
|
* Merge pull request #19787 from Senjai/patch-2Yves Senn2015-04-181-5/+4
|\ | | | | | | | | | | [Doc] Encourage users to user super to override methods. [ci skip]
| * Encourage users to user super to override methods.Richard Wilson2015-04-161-5/+4
|/ | | IMO we shouldn't encourage users to use methods they shouldn't need to know about. As Song (in this example) inherits from ActiveRecord, we can use super here instead to get the same effect with the bonus of not knowing how active record actually implements these methods.
* Batch touch parent recordsArthur Neves2015-04-081-0/+1
| | | | | | | | | | [fixes #18606] Make belongs_to use touch over touch_later when running the callbacks. Add more tests and small method rename Thanks Jeremy for the feedback.
* [ci skip] Add <tt> tag to `save!` and `create!`yui-knk2015-03-211-1/+1
|
* Add `ActiveRecord::Base.suppress`Michael Ryan2015-02-181-0/+1
|
* Add has_secure_token to Active Recordrobertomiranda2015-01-041-0/+1
| | | | | | Update SecureToken Docs Add Changelog entry for has_secure_token [ci skip]
* Extract an explicit type caster classSean Griffin2014-12-291-0/+1
|
* Clarify that query methods have a custom definition of whether a numeric ↵Michael D.W. Prendergast2014-12-231-2/+2
| | | | | value is present. [ci skip] The way Active Record query methods handle numeric values is a special case, and is not part of Rails's standard definition of present. This update attempts to make this more clear in the docs, so that people don't expect Object#present? to return false if used on a number that is zero.
* Clarify that the word present refers to Object#present?. [ci skip]Michael D.W. Prendergast2014-12-231-36/+2
| | | Update Active Record's attribute query methods documentation to clarify that whether an attribute is present is based on Object#present?. This gives people a place to go see what the exact definition of presence is. [ci skip]
* Update Active Record's attribute query methods documentation to describe its ↵Michael D.W. Prendergast2014-12-221-2/+36
| | | | full behaviour. [ci skip]
* Fix typo and remove code block since present is not a method.Rafael Mendonça França2014-07-281-1/+1
|
* docs, clarify attribute query methods on numeric columns. Closes #16246.Yves Senn2014-07-281-0/+1
| | | | [ci skip]
* Move STI docs off of the main Base document, leaving a noteSean Griffin2014-06-301-28/+3
|
* Update documentation on STI change handlingjamesprior2014-06-301-0/+9
| | | Documenting a potential source of confusion about how STI classes handle changes.
* Use `Hash#transform_values` to clean up `AttributeSet`Sean Griffin2014-06-291-0/+1
|
* Don't mess with `column_defaults` when optimistic locking is enabledSean Griffin2014-06-171-2/+2
|
* Promote time zone aware attributes to a first class type decoratorSean Griffin2014-06-161-2/+2
| | | | | | | | | | | | | This refactoring revealed the need for another form of decoration, which takes a proc to select which it applies to (There's a *lot* of cases where this form can be used). To avoid duplication, we can re-implement the old decoration in terms of the proc-based decoration. The reason we're `instance_exec`ing the matcher is for cases such as time zone aware attributes, where a decorator is defined in a parent class, and a method called in the matcher is overridden by a child class. The matcher will close over the parent, and evaluate in its context, which is not the behavior we want.
* Timestamp values should be present on callbacksRafael Mendonça França2014-06-091-1/+1
| | | | | | | This reverts commit dd3ea17191e316aeebddaa7b176f6cfeee7a6365 and add a regression test. Fixes #15418
* Merge pull request #15558 from sgrif/sg-rename-propertyRafael Mendonça França2014-06-071-2/+2
|\ | | | | | | | | | | | | | | Rename `property` to `attribute` Conflicts: activerecord/lib/active_record/attribute_methods/serialization.rb activerecord/lib/active_record/base.rb
| * Rename `property` to `attribute`Sean Griffin2014-06-071-2/+2
| | | | | | | | For consistency with https://github.com/rails/rails/pull/15557
* | Don't query the database schema when calling `serialize`Sean Griffin2014-06-071-0/+2
|/ | | | | | We need to decorate the types lazily. This is extracted to a separate API, as there are other refactorings that will be able to make use of it, and to allow unit testing the finer points more granularly.
* Add a public API to allow users to specify column typesSean Griffin2014-05-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | As a result of all of the refactoring that's been done, it's now possible for us to define a public API to allow users to specify behavior. This is an initial implementation so that I can work off of it in smaller pieces for additional features/refactorings. The current behavior will continue to stay the same, though I'd like to refactor towards the automatic schema detection being built off of this API, and add the ability to opt out of automatic schema detection. Use cases: - We can deprecate a lot of the edge cases around types, now that there is an alternate path for users who wish to maintain the same behavior. - I intend to refactor serialized columns to be built on top of this API. - Gem and library maintainers are able to interact with `ActiveRecord` at a slightly lower level in a more stable way. - Interesting ability to reverse the work flow of adding to the schema. Model can become the single source of truth for the structure. We can compare that to what the database says the schema is, diff them, and generate a migration.
* `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty ↵Lucas Mazza2014-04-231-1/+1
| | | | | | transactions. Closes #14841.
* Merge pull request #14469 from tiegz/timestamp_inheritance_fixRafael Mendonça França2014-03-271-1/+1
| | | | Swap Timestamp/Callbacks order in ActiveRecord::Base
* put core at the beginning so other classes can modify the behaviorKeenan Brock2014-01-221-1/+1
|
* Remove deprecated cattr_* requiresGenadi Samokovarov2013-12-031-1/+1
|
* add #no_touching on ActiveRecord modelsDamien Mathieu2013-11-131-0/+1
|
* Added ActiveRecord::Base#enum for declaring enum attributes where the values ↵David Heinemeier Hansson2013-11-021-0/+1
| | | | map to integers in the database, but can be queried by name
* move the cache to the AR models and populate it on inheritedAaron Patterson2013-08-301-0/+2
|
* Prefer find_by over dynamic finders in rdocSam Ruby2013-04-021-3/+3
|
* Remove useless number signTatsuro Baba2013-01-181-2/+2
| | | | I think that these signs are probably mistake.
* find_or_initialize_by is deprecated in AR 4Akira Matsuda2013-01-021-7/+0
|
* find_or_create_by is deprecated in AR 4Akira Matsuda2013-01-021-25/+0
|
* find_last_by is deprecated in AR 4Akira Matsuda2013-01-021-4/+3
|
* find_all_by is deprecated in AR 4Akira Matsuda2013-01-021-6/+3
|
* scoped_by is deprecated in AR 4Akira Matsuda2013-01-021-6/+0
|
* Added STI support to init and building associationsJason Rush2012-11-291-0/+1
| | | | | | | | Allows you to do BaseClass.new(:type => "SubClass") as well as parent.children.build(:type => "SubClass") or parent.build_child to initialize an STI subclass. Ensures that the class name is a valid class and that it is in the ancestors of the super class that the association is expecting.
* Remove observers and sweepersRafael Mendonça França2012-11-281-2/+0
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-171-19/+19
|\ | | | | | | | | Conflicts: actionpack/lib/action_dispatch/routing/redirection.rb
| * 1.9 hash syntax changesAvnerCohen2012-11-081-19/+19
| |
* | Remove duplicated ConnectionHandling extension in AR::BaseCarlos Antonio da Silva2012-11-111-1/+0
| | | | | | | | | | Thanks @toretore. https://github.com/rails/rails/commit/9e4c41c903e8e58721f2c41776a8c60ddba7a0a9#commitcomment-2134706
* | Remove not used indifferent_access requires from Base and FinderMethodsCarlos Antonio da Silva2012-11-071-1/+0
|/
* Remove ActiveRecord::ModelJon Leighton2012-10-261-3/+43
| | | | | | | | | | In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.