Commit Graph

49 Commits

Author SHA1 Message Date
Josh Kalderimis
b2451f4a7f renamed mass-assignment scopes to roles, updated code, tests, docs and security guide 2011-05-08 16:43:29 +02:00
Aaron Patterson
f1df6b2dce postgresql supports prepare statement deletes 2011-04-29 11:09:37 -07:00
Sebastian Martinez
0421002d78 Fix #update_attributes api format error 2011-04-26 14:58:06 -03:00
Josh Kalderimis
bb7024b6ec AR update_attributes api is updated to reflect the addition of assign_attributes 2011-04-26 18:00:57 +02:00
Sebastian Martinez
245542ea29 Added new #update_column method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-27 21:47:38 -03:00
Sebastian Martinez
0e1fed537a Revert "Removed #update_attribute method. New #update_column method."
This reverts commit 45c233ef81.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-27 18:55:30 -03:00
Sebastian Martinez
45c233ef81 Removed #update_attribute method. New #update_column method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-03-26 12:09:04 -03:00
Aaron Patterson
15d3cc21f4 pushing id insertion and prefetch primary keys down to Relation#insert 2011-03-22 09:18:01 -07:00
Emilio Tagua
8ee0b44148 Merge remote branch 'rails/master' into identity_map
Conflicts:
	activerecord/examples/performance.rb
	activerecord/lib/active_record/association_preload.rb
	activerecord/lib/active_record/associations.rb
	activerecord/lib/active_record/associations/association_proxy.rb
	activerecord/lib/active_record/autosave_association.rb
	activerecord/lib/active_record/base.rb
	activerecord/lib/active_record/nested_attributes.rb
	activerecord/test/cases/relations_test.rb
2011-02-15 12:01:04 -03:00
Josh Kalderimis
9d8fdfec38 removed some duplication from LH issue 5505 regarding AR touch and optimistic locking [#5505 state:resolved]
Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
2011-02-09 18:28:15 -02:00
Franck Verrot
8bc464c809 The optimistic lock column should be increased when calling touch
Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
2011-02-09 18:27:40 -02:00
Santiago Pastorino
bf22b287a4 Do not use primary key on insertion when it's nil 2010-12-29 01:22:43 -02:00
Santiago Pastorino
304d38c053 Allow primary_key to be an attribute when the model is a new record 2010-12-28 10:11:27 -02:00
Emilio Tagua
02fc6fbccd Merge remote branch 'rails/master' into identity_map
Conflicts:
	activerecord/lib/active_record/associations/association_proxy.rb
	activerecord/lib/active_record/autosave_association.rb
	activerecord/lib/active_record/base.rb
	activerecord/lib/active_record/persistence.rb
2010-12-20 11:23:07 -03:00
Aaron Patterson
12b9920a15 removing calls to deprecated methods 2010-12-02 15:07:00 -08:00
Aaron Patterson
9f0133fbf4 refactor self.class to a variable 2010-12-02 15:07:00 -08:00
José Valim
e444439fe2 Partialy revert f1c13b0dd7 2010-11-28 16:55:53 +01:00
Emilio Tagua
09f12a1270 Use identity mapper only if enabled. 2010-11-19 19:04:58 -03:00
Marcin Raczkowski
c357f842e2 IdentityMap - adding and removing of records on create/update 2010-11-19 19:04:39 -03:00
Franck Verrot
de2933e1a0 STI type is now updated when calling AR::Base.becomes on subclasses [#5953 state:resolved] 2010-11-12 02:17:34 +08:00
Santiago Pastorino
88a559d414 Double negation of an already boolean value produces the same result 2010-11-09 16:53:03 -02:00
Santiago Pastorino
75dfd95618 Don't check if persisted is defined just initialize it properly 2010-11-09 16:00:02 -02:00
David Chelimsky
1f06652a57 use persisted? instead of new_record? wherever possible
- persisted? is the API defined in ActiveModel
- makes it easier for extension libraries to conform to ActiveModel APIs
  without concern for whether the extended object is specifically
  ActiveRecord

[#5927 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-09 13:54:04 -02:00
tnp
55b6fa9370 restore behavior of touch for models without :updated_xx [#5439 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 20:42:38 +02:00
Emilio Tagua
569be76ed6 Use map instead inject.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:02 -03:00
Joost Baaij
4b14de72e1 The call-seq directive has no useful effect on our documentation and is not used anywhere else.
Worse still, its use breaks some rdoc, replacing method names with a curly brace.
Having just one call-seq directive doesn't add anything since this is covered by regular rdoc.
Having multiple might make sense, but these are already documented with examples.

This partly re-reverts 60de0e56b7 but does not
touch the vendorized code in html-scanner.
2010-08-28 00:50:50 +02:00
Xavier Noria
a820bd9df6 edit pass to a recent doc patch 2010-08-25 00:22:53 +02:00
Xavier Noria
036f090df1 Merge remote branch 'docrails/master' 2010-08-25 00:17:02 +02:00
Neeraj Singh
747e0744dd @user.touch should not fail if User does not have updated_at/updated_on column.
[#5439 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-24 11:24:32 -03:00
Neeraj Singh
f460de1d23 touch operationg if used along with belongs_to will also be invoked on associated objects 2010-08-24 10:21:58 -04:00
José Valim
e4943e93c2 Make update_attribute behave as in Rails 2.3 and document the behavior intrinsic to its implementation. 2010-08-12 12:04:16 -03:00
Xavier Noria
d191db76e0 standarizes the use of the article "an" for "SQL" and "SQLite" 2010-08-05 01:09:09 +02:00
Xavier Noria
4dc2521028 Merge remote branch 'docrails/master' into 3-0-stable 2010-08-03 02:15:12 +02:00
Neeraj Singh
1ce40ca562 ensuring that description does not exceed 100 columns 2010-08-02 12:25:26 -04:00
José Valim
b613c3cc7b Add an internal (private API) after_touch callback. [#5271 state:resolved] 2010-08-02 16:16:46 +02:00
Neeraj Singh
31f8a0cd23 adding punctuations 2010-07-28 13:10:04 -04:00
Neeraj Singh
51924d49af more documentation for update_attribute 2010-07-28 12:51:36 -04:00
Neeraj Singh
c9fe3c3bd0 adding comments to update_attribute method 2010-07-27 13:55:00 -04:00
Neeraj Singh
5c137939a7 expanded comment for update_attribute method 2010-07-22 01:28:30 +02:00
Neeraj Singh
992711a86b update_attribute should not update readonly attributes
[#5106 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-21 14:55:57 +02:00
Xavier Noria
b7944e1b21 revises the rdoc of update_attributes and update_attributes! to document they are wrapped in a transaction, and adds code comments explaining why 2010-07-14 17:42:57 +02:00
Neeraj Singh
f4fbc2c1f9 update_attributes and update_attributes! are now wrapped in a transaction
[#922 state:resovled]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-13 22:02:00 +02:00
José Valim
3401311562 Tidying up a bit, so update_attribute is not called twice on touch. 2010-07-13 08:05:09 +02:00
Neeraj Singh
1d45ea0814 with this fix touch method - does not call validations - doest not call callbacks - updates updated_at/on along with attribute if attribute is provided - marks udpated_at/on and attribute as NOT changed
[#2520 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-13 07:03:42 +02:00
José Valim
87f64ef05e Improve a bit the code in latest commits. 2010-07-08 22:59:41 +02:00
Neeraj Singh
01629d1804 This patch changes update_attribute implementatino so:
- it will only save the attribute it has been asked to save and not all dirty attributes

- it does not invoke callbacks

- it does change updated_at/on

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-08 22:43:18 +02:00
José Valim
bd1666ad1d Add scoping and unscoped as the syntax to replace the old with_scope and with_exclusive_scope. A few examples:
* with_scope now should be scoping:

Before:

  Comment.with_scope(:find => { :conditions => { :post_id => 1 } }) do
    Comment.first #=> SELECT * FROM comments WHERE post_id = 1
  end

After:

  Comment.where(:post_id => 1).scoping do
    Comment.first #=> SELECT * FROM comments WHERE post_id = 1
  end

* with_exclusive_scope now should be unscoped:

  class Post < ActiveRecord::Base
    default_scope :published => true
  end

  Post.all #=> SELECT * FROM posts WHERE published = true

Before:

  Post.with_exclusive_scope do
    Post.all #=> SELECT * FROM posts
  end

After:

  Post.unscoped do
    Post.all #=> SELECT * FROM posts
  end

Notice you can also use unscoped without a block and it will return an anonymous scope with default_scope values:

  Post.unscoped.all #=> SELECT * FROM posts
2010-06-29 17:18:55 +02:00
Rizwan Reza
d8277804b2 Adds title and minor changes. 2010-06-16 22:08:14 +04:30
wycats
d916c62cfc eliminate alias_method_chain from ActiveRecord 2010-05-09 02:37:52 +03:00