aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
Commit message (Collapse)AuthorAgeFilesLines
* Added support for associating unsaved objects #402 [Tim Bates]David Heinemeier Hansson2005-01-151-3/+3
| | | | | | | | | Added replace to associations, so you can do project.manager.replace(new_manager) or project.milestones.replace(new_milestones) #402 [Tim Bates] Added build and create methods to has_one and belongs_to associations, so you can now do project.manager.build(attributes) #402 [Tim Bates] Fixed that Base#== wouldn't work for multiple references to the same unsaved object #402 [Tim Bates] Added that if a before_* callback returns false, all the later callbacks and the associated action are cancelled. If an after_* callback returns false, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks defined as methods on the model, which are called last. #402 [Tim Bates] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@417 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Refactored ActiveRecord::Base#clone to use Base#attributes #463 [atyp]David Heinemeier Hansson2005-01-131-11/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@401 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Base#attributes that returns a hash of all the attributes with their ↵David Heinemeier Hansson2005-01-111-0/+12
| | | | | | names as keys and clones of their objects as values #433 [atyp.de] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@386 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Base#reload that reloads the attributes of an object from the database ↵David Heinemeier Hansson2005-01-101-1/+8
| | | | | | #422 [Andreas Schwarz] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@376 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed Base#update_attribute to be indifferent to whether a string or symbol ↵David Heinemeier Hansson2005-01-061-1/+1
| | | | | | is used to describe the name git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@341 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Base#toggle(attribute) and Base#toggle!(attribute) that makes it ↵David Heinemeier Hansson2005-01-061-6/+41
| | | | | | easier to flip a switch or flag. Added Base#increment!(attribute) and Base#decrement!(attribute) that also saves the records. Added Base#increment(attribute) and Base#decrement(attribute) that encapsulates the += 1 and -= 1 patterns. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@340 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that the overwritten respond_to? method didn't take two parameters ↵David Heinemeier Hansson2005-01-031-2/+2
| | | | | | like the original #391 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@326 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added the possibility of specifying the remaining options for find_first and ↵David Heinemeier Hansson2005-01-021-8/+11
| | | | | | find_all with the new find_by/all_by* dynamic finders [danp] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@316 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added find_all style to the new dynamic findersDavid Heinemeier Hansson2005-01-021-4/+9
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@308 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added dynamic attribute-based finders as a cleaner way of getting objects by ↵David Heinemeier Hansson2005-01-021-0/+25
| | | | | | simple queries without turning to SQL. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@307 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Restored bind arity checking #412 [bitsweat]David Heinemeier Hansson2005-01-021-7/+8
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@306 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added that Base#find takes an optional options hash, including :conditions. ↵David Heinemeier Hansson2005-01-011-64/+68
| | | | | | Base#find_on_conditions deprecated in favor of #find with :conditions #407 [bitsweat] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@305 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added a db2 adapter that only depends on the Ruby/DB2 bindings ↵David Heinemeier Hansson2005-01-011-3/+3
| | | | | | (http://raa.ruby-lang.org/project/ruby-db2/) #386 [Maik Schmidt]. Converted all the fixtures to YAML style ones. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@303 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added automated optimistic locking if the field lock_version is present #384 ↵David Heinemeier Hansson2004-12-311-0/+2
| | | | | | [Michael Koziarski] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@295 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Switch dispatcher to use the new shared Dependencies approachDavid Heinemeier Hansson2004-12-291-9/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@280 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Base.default_timezone accessor that determines whether to use ↵David Heinemeier Hansson2004-12-281-0/+5
| | | | | | Time.local (using :local) or Time.utc (using :utc) when pulling dates and times from the database. This is set to :local by default. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@271 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added the possibility for adapters to overwrite add_limit! to implement a ↵David Heinemeier Hansson2004-12-281-3/+5
| | | | | | different limiting scheme than "LIMIT X" used by MySQL, PostgreSQL, and SQLite. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@269 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that Base.table_name would expect a parameter when used in ↵David Heinemeier Hansson2004-12-221-7/+2
| | | | | | has_and_belongs_to_many joins [Anna Lissa Cruz] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@244 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Switched strategy on the id_before_type_cast problem and just did an ↵David Heinemeier Hansson2004-12-201-1/+5
| | | | | | explicit method so postgresql wouldnt choke on id is null git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@234 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Pulling attributes_from_column_definition should set the primary id to nil ↵David Heinemeier Hansson2004-12-191-1/+1
| | | | | | instead of not at all git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@232 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Scrap thatDavid Heinemeier Hansson2004-12-191-1/+0
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@231 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Dont define respond_to? lookups for primary keyDavid Heinemeier Hansson2004-12-191-0/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@230 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* FormHelper should only use *_before_type_cast if they available on the modelDavid Heinemeier Hansson2004-12-191-0/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Changed the interface on AbstractAdapter to require that adapters return the ↵David Heinemeier Hansson2004-12-191-3/+3
| | | | | | number of affected rows on delete and update operations. Added that Base.update_all and Base.delete_all return an integer of the number of affected rows #341 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@228 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added respondence to *_before_type_cast for all attributes to return their ↵David Heinemeier Hansson2004-12-191-9/+14
| | | | | | string-state before they were type casted by the column type. Added use of *_before_type_cast for all input and text fields. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Base#update_attribute isnt subject to validationDavid Heinemeier Hansson2004-12-181-2/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@210 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Made Base#update_attributes actually workDavid Heinemeier Hansson2004-12-181-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@209 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Base#update_attributes that'll accept a hash of attributes and save ↵David Heinemeier Hansson2004-12-171-1/+7
| | | | | | the record (returning true if it passed validation, false otherwise). Added a return value for Base#update_attribute, so that you get to know whether the save was successful or if it failed validation. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@207 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Base.destroy and Base.delete to remove records without holding a ↵David Heinemeier Hansson2004-12-171-0/+10
| | | | | | reference to them first. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@206 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Improving documentation...David Heinemeier Hansson2004-12-161-0/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@191 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that Base#find will return an array if given an array -- regardless of ↵David Heinemeier Hansson2004-12-151-1/+3
| | | | | | the number of elements #270 [Marten] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@164 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added a better exception for when a type column is used in a table without ↵David Heinemeier Hansson2004-12-141-2/+17
| | | | | | the intention of triggering single-table inheritance. Added that single-table inheritance will only kick in if the inheritance_column (by default "type") is present. Otherwise, inheritance wont have any magic side effects git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@149 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added methods for resetting the cached information on classes that you want ↵David Heinemeier Hansson2004-12-121-5/+10
| | | | | | to clear between requests in development mode git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@130 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Moved require_association to associations.rb and added methods for resetting ↵David Heinemeier Hansson2004-12-121-28/+4
| | | | | | the inheritable attributes on subclasses git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@125 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added Base.validate_uniqueness thatv alidates whether the value of the ↵David Heinemeier Hansson2004-12-101-2/+8
| | | | | | specified attributes are unique across the system. Useful for making sure that only one user can be named "davidhh". git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@108 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added named bind-style variable interpolation #281 [Michael Koziarski]David Heinemeier Hansson2004-12-081-6/+35
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@78 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added the option for sanitizing find_by_sql and the offset parts in regular ↵David Heinemeier Hansson2004-12-071-4/+9
| | | | | | finds [Sam Stephenson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@75 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed value quoting in all generated SQL statements, so that integers are ↵David Heinemeier Hansson2004-12-071-12/+19
| | | | | | not surrounded in quotes and that all sanitation are happening through the database's own quoting routine. This should hopefully make it lots easier for new adapters that doesn't accept '1' for integer columns. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@70 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added bind-style variable interpolation for the condition arrays that uses ↵David Heinemeier Hansson2004-12-071-11/+15
| | | | | | the adapter's quote method [Michael Koziarski] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@56 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added extra words of caution for guarding against SQL-injection attacksDavid Heinemeier Hansson2004-12-061-3/+7
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@46 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Dont include the primary key in updates -- its unneeded and SQL Server ↵David Heinemeier Hansson2004-12-011-3/+3
| | | | | | chokes on it git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@42 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Moved the global require_* out of the classes so they actually work without ↵David Heinemeier Hansson2004-11-301-3/+5
| | | | | | stack overflows git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@33 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Abolished ActionController::Base.require_or_load in favor of ↵David Heinemeier Hansson2004-11-301-3/+11
| | | | | | require_dependency and ActiveRecord::Base.require_or_load in favor of require_association. Both methods are now also available in the global namespace when you need to require dependencies or associations outside of whats done automatically. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@32 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Silence errors occurring when reloading classesDavid Heinemeier Hansson2004-11-301-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@27 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* InitialDavid Heinemeier Hansson2004-11-241-0/+1051
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4 5ecf4fe2-1ee6-0310-87b1-e25e094e27de