Commit Graph

3960 Commits

Author SHA1 Message Date
J. Pablo Fernández
21957b72ea Test that adding an index also doesn't raise an exception.
[#4809 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 21:17:12 +02:00
Paul Barry
0baf83fa18 Replaced statement in comment with an assertion
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-29 21:17:08 +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
José Valim
67582f08bf Push a failing test for issues [#4994] and [#5003]. 2010-06-29 19:50:09 +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
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
José Valim
dd8b7417a9 Update CHANGELOGs. 2010-06-28 11:37:14 +02:00
Łukasz Strzałkowski
be994e2c50 Information about new rake task in CHANGELOG
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-28 11:27:15 +02:00
Santiago Pastorino
ab96c71a52 Add this rule to run common tests and specifics ones from adapters dir 2010-06-27 21:20:53 -07: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
Santiago Pastorino
6c28959e86 Move sqlite to sqlite3 for this tests to be run only on sqlite3 adapter
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-28 01:26:25 +02: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
Santiago Pastorino
a2513aea07 Test for concatenated orders added
[#4972]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-06-26 00:59:11 +02:00
Aaron Patterson
5e2b473b47 reorganizing adapter specific tests. [#4974 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-06-25 14:47:14 -07:00
Santiago Pastorino
efbd0eb9f7 Order is not guaranteed here, ordering by id of people table makes it work 2010-06-25 12:44:57 -07: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