aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* removes the convenience instance version of AR::Base.silence_auto_explainXavier Noria2011-12-031-1/+1
| | | | | | | Rationale: As discussed with José and Jon, this convenience shortcut is not clearly justified and it could let the user thing the disabled EXPLAINs are related to the model instance rather than being globally disabled.
* implements AR::Base(.|#)silence_auto_explainXavier Noria2011-12-021-1/+1
|
* implements automatic EXPLAIN logging for slow queriesXavier Noria2011-12-021-1/+9
|
* Remove the need for type_cast_attribute.Jon Leighton2011-12-011-1/+1
| | | | This is good because it reduces duplication.
* Get rid of the underscore versions of attribute methods!Jon Leighton2011-12-011-0/+1
| | | | This makes me happy!
* Revert "Added ActiveRecord::Base#last_modified to work with the new ↵David Heinemeier Hansson2011-12-011-7/+0
| | | | | | | | fresh_when/stale? conditional get methods from Action Pack" Needless indirection with no added value. This reverts commit 535853e83b9092078035a5abb2aa242fba815c05.
* Added ActiveRecord::Base#last_modified to work with the new ↵David Heinemeier Hansson2011-12-011-0/+7
| | | | fresh_when/stale? conditional get methods from Action Pack
* Add hackery to make Syck use encode_with/init_with. Fixes 1.8 after recent ↵Jon Leighton2011-12-011-0/+20
| | | | changes to attribute serialization.
* omg computer science!Jon Leighton2011-11-301-2/+2
| | | | | | | 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.
* Move some serialization stuff out of BaseJon Leighton2011-11-301-40/+0
|
* Extract attribute serialization code into a separate moduleJon Leighton2011-11-301-0/+1
|
* ActiveRecord::Relation#pluck methodBogdan Gusiev2011-11-301-1/+1
|
* Fix ruby 1.8 compat. const_defined? only takes a second arg on 1.9.Jon Leighton2011-11-291-3/+4
|
* Deprecated `define_attr_method` in `ActiveModel::AttributeMethods`Jon Leighton2011-11-291-2/+2
| | | | | This only existed to support methods like `set_table_name` in Active Record, which are themselves being deprecated.
* Make sure the original_foo accessor still works (but deprecated) if we are ↵Jon Leighton2011-11-291-6/+31
| | | | using self.foo=
* extract methodJon Leighton2011-11-291-49/+25
|
* Deprecate set_sequence_name in favour of self.sequence_name=Jon Leighton2011-11-291-11/+28
|
* Add tests for set_sequence_name etcJon Leighton2011-11-291-1/+1
|
* Deprecate set_inheritance_column in favour of self.inheritance_column=Jon Leighton2011-11-291-17/+29
|
* Deprecate set_table_name in favour of self.table_name= or defining your own ↵Jon Leighton2011-11-291-22/+59
| | | | method.
* Merge pull request #3636 from joshsusser/masterJon Leighton2011-11-291-0/+14
|\ | | | | association methods are now generated in modules
| * use GeneratedFeatureMethods module for associationsJosh Susser2011-11-271-0/+14
| |
* | remove useless class_evalAaron Patterson2011-11-281-2/+0
| |
* | pushing caching and visitors down to the connectionAaron Patterson2011-11-191-9/+9
|/
* self.up, self.down => up, downAkira Matsuda2011-11-071-2/+2
|
* Update ActiveRecord#attribute_present? to work as documentedJustin Mazzi2011-11-051-1/+2
| | | | | | | "Returns true if the specified attribute has been set by the user or by a database load and is neither nil nor empty?" Fixes #1613
* Add ActiveRecord::Relation#uniq for toggling DISTINCT in the SQL queryJon Leighton2011-11-051-1/+3
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2011-10-141-2/+2
|\
| * change activerecord query conditions example to avoid 'type' as column nameSteve Bourne2011-10-121-2/+2
| | | | | | | | | | | | | | | | 'Type' is a reserved column for STI. Changed conditions example to avoid using that column name as an example. The example isn't STI-related (and mentioning STI here is needless clutter), so changing to avoid accidentally encouraging users to use 'type' as a column name for other purposes.
* | Added ActiveRecord::Base.store for declaring simple single-column key/value ↵David Heinemeier Hansson2011-10-131-1/+1
|/ | | | stores [DHH]
* Revert "Raise error on unknown primary key."Jon Leighton2011-10-051-5/+4
| | | | This reverts commit ee2be435b1e5c0e94a4ee93a1a310e0471a77d07.
* Raise error on unknown primary key.Jon Leighton2011-10-051-4/+5
| | | | | 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-0/+4
| | | | Closes #2807.
* Rename first_or_new to first_or_initialize.Jon Leighton2011-09-131-1/+1
| | | | | For consistency with find_or_initialize_by. Also remove first_or_build alias.
* Always generate attribute methods on the base class.Jon Leighton2011-09-131-1/+1
| | | | | | | | | | | | | | This fixes a situation I encountered where a subclass would cache the name of a generated attribute method in @_defined_class_methods. Then, when the superclass has it's attribute methods undefined, the subclass would always have to dispatch through method_missing, because the presence of the attribute in @_defined_class_methods would mean that it is never generated again, even if undefine_attribute_methods is called on the subclass. There various other confusing edge cases like this. STI classes share columns, so let's just keep all the attribute method generation state isolated to the base class.
* Adding first_or_create, first_or_create!, first_or_new and first_or_build to ↵Andrés Mejía2011-08-301-0/+1
| | | | | | | | | | Active Record. This let's you write things like: User.where(:first_name => "Scarlett").first_or_create!(:last_name => "Johansson", :hot => true) Related to #2420.
* Move clear_timestamp_attributes into Timestamp moduleJon Leighton2011-08-291-9/+1
|
* do not compute table names for abstract classesAkira Matsuda2011-08-241-0/+2
|
* In 1efd88283ef68d912df215125951a87526768a51, ConnectionAdapters was put ↵Jon Leighton2011-08-161-1/+2
| | | | under eager_autoload. Due to the requires in that file, this caused ConnectionSpecification to be loaded, which references ActiveRecord::Base, which means the database connection is established. We do not want to connect to the database when Active Record is loaded, only when ActiveRecord::Base is first referenced by the user.
* Merge branch 'master' of github.com:lifo/docrailsXavier Noria2011-08-131-0/+4
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: RELEASING_RAILS.rdoc actionpack/lib/sprockets/railtie.rb actionpack/test/template/sprockets_helper_test.rb activerecord/test/cases/calculations_test.rb railties/guides/source/3_1_release_notes.textile railties/guides/source/active_resource_basics.textile railties/guides/source/command_line.textile
| * Document exclamation point on dynamic findersFlorent Guilleux2011-08-131-0/+4
| |
| * Revert "Explicitly included hashes in sentence regarding SQL-injection-safe ↵Xavier Noria2011-08-131-3/+3
| | | | | | | | | | | | | | | | forms" Reason: The hash form is secure, and preferred over the array form if possible. This reverts commit 6dc749596c328c44c80f898d5fa860fff6cab783.
| * Explicitly included hashes in sentence regarding SQL-injection-safe formsPete Campbell2011-07-281-3/+3
| |
* | Perf: don't mess around with thread local vars unless we actually need toJon Leighton2011-08-131-18/+23
| |
* | Fix default scope thread safety. Thanks @thedarkone for reporting.Jon Leighton2011-08-131-15/+26
| |
* | Fully marshal AR::Base objects. Fixes #2431.Jon Leighton2011-08-081-21/+0
| |
* | Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-2/+1
| | | | | | | | for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
* | Revert "Explicitly included hashes in sentence regarding SQL-injection-safe ↵Xavier Noria2011-08-041-3/+3
| | | | | | | | | | | | | | | | forms" Reason: The hash form is secure, and preferred over the array form if possible. This reverts commit 6dc749596c328c44c80f898d5fa860fff6cab783.
* | Explicitly included hashes in sentence regarding SQL-injection-safe formsPete Campbell2011-08-041-3/+3
|/
* fix after_initialize edge case (close #2074 and close #2175)Les Fletcher2011-07-241-2/+1
| | | | fix behavior when after_initialize is defined and a block is passed to Base.create