Commit Graph

3246 Commits

Author SHA1 Message Date
José Valim
53b34e8476 Avoid calls to Rails::Application since this is not the official API.
Your application should *always* reference your application const (as Blog::Application) and Rails.application should be used just internally.
2010-07-01 18:43:44 +02:00
James Le Cuirot
f3fedd7f84 Don't remove scheduled destroys when loading an association. [#4642 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-01 01:06:58 +02:00
José Valim
57d750edf7 Make relation a private method. 2010-07-01 00:09:55 +02:00
Xavier Noria
c63cf7bf0d Merge remote branch 'rails/master' 2010-06-30 20:47:26 +02:00
Jeremy Kemper
b07e6fdaa0 Support any mysql-like adapter 2010-06-30 10:38:49 -07:00
Aaron Patterson
3f563f1696 AssociationCollection#create_by_*, find_or_create_by_* work properly now. [#1108 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-29 16:13:40 -07:00
Tekin
d7c2e52c6c migrations.rb requires active_support/core_ext/module/aliasing [#5008 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-06-30 00:53:23 +02:00
J. Pablo Fernández
ff22b9d451 Fixed error when removing an index from a table name values, which is a reserved word, with test.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 21:17:07 +02:00
José Valim
af6ec607fa No need to check if the attribute exists (this is the same behavior as in 2.3) [#4994 state:resolved] and [#5003 state:resolved] 2010-06-29 20:15:32 +02:00
Neeraj Singh
dabf74b495 array subtraction should be faster than iterating over all the elements
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 17:57:06 +02:00
Neeraj Singh
e8f88a3298 splitting a really long line into multiple lines which is easy on eyes
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 17:57:01 +02:00
David Trasbo
735a4db685 Remove ActiveRecord::Base#class_name [#379 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 17:54:51 +02:00
José Valim
417125e795 Tidy up deprecation message for with_exclusive_scope. 2010-06-29 17:42:20 +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
Adam Meehan
8fbb5177a7 accepts_nested_attributes_for typo 2010-06-29 13:32:53 +10:00
Santiago Pastorino
093c4eedd0 Remove unneeded reject 2010-06-28 19:14:40 -07:00
Neeraj Singh
40e87ac669 with_exclusive_scope does not work properly if ARel is passed. It does work nicely if hash is passed. Blow up if user is attempting it pass ARel to with_exclusive_scope.
[#3838 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 01:18:20 +02:00
Akira Matsuda
4f74d449ee Avoid "no such table" exception when schema migrations table does not exist
[#4990 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-27 21:16:34 -07:00
Akira Matsuda
0e5d7c6f64 Use ActiveRecord::Migrator.schema_migrations_table_name instead of hardcoding "schema_migrations"
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-27 21:16:09 -07:00
Santiago Pastorino
06b0d6e5cd Add missing require, Base use deprecate method 2010-06-27 20:45:09 -07:00
Kevin Skoglund
8e3e117dbe rake db:migrate:status displays status of migrations [#4947 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-06-28 14:08:40 +12:00
Jeremy Kemper
fb7715b249 Warn that ActiveRecord::Base.reset_subclasses is gone in Rails 3 final. 2010-06-27 18:58:18 -07:00
Xavier Noria
4329f8133f Merge remote branch 'rails/master' 2010-06-28 00:12:15 +02:00
George Montana Harkin
0c0b0aa0f2 Fixes #2415 by creating a new instance of the Model when saving attributes to that model and the associated attributes already exist. Tests included. [#2415 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-27 16:35:03 +02:00
Aaron Patterson
abd568bf1c removing useless code. [#4988 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-26 19:51:59 -07:00
Santiago Pastorino
8d9545389f Refactor: metaprogramming here it's confusing and make use of tap
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-26 19:44:44 -07:00
Santiago Pastorino
8f358f397f Refactor of column_exists? method and this works with PostgreSQL 2010-06-26 17:09:46 -07:00
Santiago Pastorino
64fee27a55 Removes useless flatten 2010-06-26 17:09:40 -07:00
Evgeniy Dolzhenko
a39f2657b1 Add module_eval missing file_name and line_number args [#4712 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 22:38:54 +02:00
Aaron Patterson
100d2282e3 adding adapter tests, avoiding private apis, fixing code in 1.9 [#4986 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 22:37:45 +02:00
José Valim
5b91c97763 Create a little bit less objects in ARel. 2010-06-26 22:37:24 +02:00
Aaron Patterson
6e65573222 refactoring the postgres adapter index method to avoid inject and use values_at. [#4976 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 01:35:38 +02:00
Santiago Pastorino
47134a04bb blocks removed from all the ActiveRelation query_methods, extend method added instead
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 01:35:23 +02:00
José Valim
026cec3390 Merge branch 'tago' 2010-06-26 01:08:57 +02:00
Andrew White
11ff3da5f4 Add column and index query methods to ActiveRecord::Schema
[#4219 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 01:08:32 +02:00
Aaron Patterson
4464d10e68 index dump should not include full text indexes. Thanks Ken Mayer for the original patch! [#4949 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 00:59:38 +02:00
Santiago Pastorino
65aa6a7db1 reorder method added to ActiveRelation
[#4972 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 00:59:12 +02:00
Neeraj Singh and Santiago Pastorino
0ebb5bf659 Support for multiple selects added
[#4841 state:committed]
2010-06-25 15:57:04 -03:00
Santiago Pastorino
3d8ccb9240 Makes a build_select for the select part of build_arel 2010-06-25 15:06:32 -03:00
Santiago Pastorino
82dc16b7d2 Metaprogramming not needed here 2010-06-25 15:06:32 -03:00
Santiago Pastorino
3344c011da Avoid a blank line before the add/remove columns 2010-06-25 15:06:32 -03:00
Łukasz Strzałkowski
518b16d9ae Line break in migration template and nicer code indentation
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-25 10:57:05 +02:00
José Valim
73682d016c Merge remote branch 'miloops/fixes' 2010-06-24 20:19:19 +02:00
Santiago Pastorino
7a7c608a26 Your original TIME ZONE value on PostgreSQL is correctly restored now, after going through options :utc and then going back to :local
[#4950 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-24 20:12:22 +02:00
Santiago Pastorino
497a0c3b00 quotes are not necessary here
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-24 20:12:22 +02:00
Emilio Tagua
4b5f417e63 Only yield block if given. 2010-06-24 13:17:24 -03:00
Emilio Tagua
2c203a9413 Remove block definitions in finder methods. 2010-06-24 13:07:39 -03:00
Emilio Tagua
4086ecea24 Remove block definition from method, is not needed since yield is used inside. 2010-06-24 12:02:00 -03:00
Emilio Tagua
d9f199e123 Don't define block, just yield if block is given. 2010-06-24 11:40:23 -03:00
Emilio Tagua
fdb7f84eb1 Remove deprecated block usage in composed_of. 2010-06-24 11:17:05 -03:00