aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add documentation for find_or_create_by_{attribute}! method.Andrew White2012-03-121-0/+3
|
* deleted duplicated linejuan david pastas2012-01-051-1/+0
|
* No need to require psych since require yaml does that.Rafael Mendonça França2012-01-041-1/+0
|
* No need to use rescue block to require psychRafael Mendonça França2012-01-041-5/+1
|
* Support establishing connection on ActiveRecord::Model.Jon Leighton2011-12-281-1/+0
| | | | | This is the 'top level' connection, inherited by any models that include ActiveRecord::Model or inherit from ActiveRecord::Base.
* Support configuration on ActiveRecord::Model.Jon Leighton2011-12-281-1/+0
| | | | | | | | | | | | | | | The problem: We need to be able to specify configuration in a way that can be inherited to models that include ActiveRecord::Model. So it is no longer sufficient to put 'top level' config on ActiveRecord::Base, but we do want configuration specified on ActiveRecord::Base and descendants to continue to work. So we need something like class_attribute that can be defined on a module but that is inherited when ActiveRecord::Model is included. The solution: added ActiveModel::Configuration module which provides a config_attribute macro. It's a bit specific hence I am not putting this in Active Support or making it a 'public API' at present.
* Fix position of load hook so that Base has been defined and included Model ↵Jon Leighton2011-12-241-0/+3
| | | | before it runs
* Deal with global config better between AR::Base and AR::ModelJon Leighton2011-12-241-1/+0
|
* I herd you like modules.Jon Leighton2011-12-241-0/+2
|
* Start work towards making AR include-able.Jon Leighton2011-12-241-369/+1
|
* Remove 1.8 backportJon Leighton2011-12-221-9/+0
|
* Make read_attribute code path accessible at the class levelJon Leighton2011-12-221-6/+3
|
* AS::Concern is not really needed for AR::ExplainXavier Noria2011-12-161-1/+1
|
* Move DefaultScope and NamedScope under ScopingJon Leighton2011-12-151-2/+1
|
* Let AttributeMethods do its own including etcJon Leighton2011-12-151-17/+0
|
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-1578/+58
|
* Make with_scope public so we stop using send :bomb:José Valim2011-12-151-90/+91
|
* Allow nested attributes in associations to update values in it's owner ↵Andrew Kaspick2011-12-141-1/+11
| | | | object. Fixes a regression from 3.0.x
* Cache column defaults on model. ~30% on Model.new due to avoiding repeatedly ↵Jon Leighton2011-12-141-2/+2
| | | | fetching connection.
* Use `table_exists?` from the schema cache.Aaron Patterson2011-12-091-1/+1
|
* Remove NilClass whiners feature.José Valim2011-12-081-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Removing this feature causes boost in performance when using Ruby 1.9. Ruby 1.9 started to do implicit conversions using `to_ary` and `to_str` in some STDLIB methods (like Array#join). To do such implicit conversions, Ruby 1.9 always dispatches the method and rescues the NoMethodError exception in case one is raised. Therefore, since the whiners feature defined NilClass#method_missing, such implicit conversions for nil became much, much slower. In fact, just defining NilClass#method_missing (even without the whiners feature) already causes a massive slow down. Here is a snippet that shows such slow down: require "benchmark" Benchmark.realtime { 1_000.times { [nil,nil,nil].join } } class NilClass def method_missing(*args) raise NoMethodError end end Benchmark.realtime { 1_000.times { [nil,nil,nil].join } }
* Merge pull request #3851 from ebeigarts/fix_sequence_nameJon Leighton2011-12-041-2/+2
|\ | | | | Fix sequence name with abstract classes.
| * Fix sequence name with abstract classes.Edgars Beigarts2011-12-041-2/+2
| |
* | Merge branch 'explain'Xavier Noria2011-12-041-0/+1
|\ \ | |/ |/|
| * implements a much faster auto EXPLAIN, closes #3843 [José Valim & Xavier Noria]Xavier Noria2011-12-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit vastly reduces the impact of auto explain logging when enabled, while keeping a negligible cost when disabled. The first implementation was based on the idea of subscribing to "sql.active_record" when needed, and unsubscribing once done. This is the idea behind AR::Relation#explain. Subscribe, collect, unsubscribe. But with the current implementation of notifications unsubscribing is costly, because it wipes an internal cache and that puts a penalty on the next event. So we are switching to an approach where a long-running subscriber is listening. Instead of collecting the queries with a closure in a dedicated subscriber, now we setup a thread local. If the feature is disabled by setting the threshold to nil, the subscriber will call a method that does nothing. That's totally cheap.
* | Refactor readonly attributes conditionalCarlos Antonio da Silva2011-12-041-1/+2
|/
* 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
|/