Commit Graph

14 Commits

Author SHA1 Message Date
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