Commit Graph

3157 Commits

Author SHA1 Message Date
Aaron Patterson
9b46613780 Merge pull request #3521 from nulogy/fix_postgres_adapter_to_handle_spaces_between_schemas
Fix postgres adapter to handle spaces between schemas
2011-11-06 13:16:07 -03:00
Justin Mazzi
c7d2078596 Update ActiveRecord#attribute_present? to work as documented
"Returns true if the specified attribute has been set by the user or by
a database load and is neither nil nor empty?"

Fixes #1613
2011-11-05 22:36:19 -04:00
Xavier Noria
e7b7b44123 implements AR::Relation#explain
This is a first implementation, EXPLAIN is highly
dependent on the database and I have made some
compromises.

On one hand, the method allows you to run the most
common EXPLAIN and that's it. If you want EXPLAIN
ANALYZE in PostgreSQL you need to do it by hand.

On the other hand, I've tried to construct a string
as close as possible to the ones built by the
respective shells. The rationale is that IMO the
user should feel at home with the output and
recognize it at first sight. Per database.

I don't know whether this implementation is going
to work well. Let's see whether people like it.
2011-11-05 18:30:19 -07:00
Jon Leighton
f575e21025 Merge pull request #3525 from kennyj/fix_3440-1
Fixed an issue id false option is ignored on mysql/mysql2 (fix #3440)
2011-11-05 10:29:18 -07:00
kennyj
fb0bf3c984 Fixed an issue id false option is ignored on mysql/mysql2 (fix #3440) 2011-11-06 02:15:47 +09:00
Jon Leighton
562583c766 Add ActiveRecord::Relation#uniq for toggling DISTINCT in the SQL query 2011-11-05 16:22:18 +00:00
Vlad Jebelev
69dcd45aea AR changes to support creating ordered (asc, desc) indexes 2011-11-04 15:45:24 -05:00
Arun Agrawal
6da558660c Fix test as one more has_many added 2011-11-04 19:30:59 +05:30
Jon Leighton
e6cc2ea201 Allow the :class_name option for associations to take a symbol.
This is to avoid confusing newbies, and to be consistent with the fact
that other options like :foreign_key already allow a symbol or a string.
2011-11-04 11:17:56 +00:00
Aaron Patterson
0e407a9041 Merge pull request #1163 from amatsuda/sexier_migration_31
Sexier migrations
2011-11-04 03:29:59 -07:00
Jeremy Kemper
533a9f84b0 Merge pull request #3507 from jmazzi/issue-3503
Preserve SELECT columns on the COUNT for finder_sql when possible
2011-11-03 21:17:15 -07:00
Jon Leighton
d486103570 Fix #3271.
Building the conditions of a nested through association could
potentially modify the conditions of the through and/or source
association.

This is a Bad Thing.
2011-11-03 15:12:08 +00:00
Jon Leighton
19b2a5f2bd Remove all revelant through records.
If a record is removed from a has_many :through, all of the join records
relating to that record should also be removed from the through
association's target.

(Previously the records were removed in the database, but only one was
removed from the in-memory target array.)
2011-11-03 13:13:13 +00:00
Jon Leighton
71bc921ec8 Fix adding multiple instances of the same record to a has_many :through.
Fixes #3425.
2011-11-03 12:39:05 +00:00
Jon Leighton
b4b178f7e9 Fix #3247.
Fixes creating records in a through association with a polymorphic source
type.
2011-11-03 10:23:42 +00:00
Vijay Dev
1afe269a4a assert_match takes a regexp and a string in that order 2011-10-31 19:01:03 +05:30
Laust Rud Jacobsen
ff9c2799c1 dump_schema_information: explicitly order inserts into schema_migrations table
This change reduces churn in the db/development_structure.sql file when using :sql as
active_record.schema_format, and makes comparing diffs much easier.

Test ensures the output SQL-statements are lexically ordered by version.
2011-10-31 10:36:13 +01:00
Joe Van Dyk
420f7fd507 Added failing test case for changing schema in migration not clearing the prepared statement cache 2011-10-27 10:50:38 -07:00
Arun Agrawal
95d9c120d3 More checks for instance writers. 2011-10-27 16:25:50 +05:30
Arun Agrawal
80fc29f36f Adding more checks for instance_writer false 2011-10-27 15:47:56 +05:30
Arun Agrawal
485b99611b Test fix Allow instances to disable record_timestamps
Removed here 0d0176c4ffe5c58fd1002efbd8f7bd45a8872e33
2011-10-27 15:41:15 +05:30
Pratik Naik
0d0176c4ff Allow instances to disable record_timestamps 2011-10-26 18:20:12 +01:00
David Heinemeier Hansson
1d9ab88ee6 Merge branch 'master' of github.com:rails/rails 2011-10-25 17:22:55 -05:00
David Heinemeier Hansson
5daf07704a Fix that changing a store should mark the store attribute as changed 2011-10-25 17:22:52 -05:00
Greg Reinacker
f092be821d preserve decimal column attributes after migration 2011-10-21 17:30:39 -06:00
Aaron Patterson
ee9d9fb5fa Merge pull request #3258 from ileitch/3-1-stable
Postgres: Do not attempt to deallocate a statement if the connection is no longer active.
2011-10-20 08:45:22 -07:00
Aaron Patterson
c2f3c9bf56 only use now() on pg! 2011-10-18 13:30:01 -07:00
Aaron Patterson
6a28c512e3 reset prepared statement when schema changes imapact statement results. fixes #3335 2011-10-18 11:20:13 -07:00
Aaron Patterson
76af2818a6 use now() for dates in pg 2011-10-18 10:07:40 -07:00
José Valim
7511f9794d Merge pull request #3340 from surfacedamage/exclude_destroy_in_all_blank_check
Exclude _destroy parameter in :all_blank check (issue #2937)
2011-10-17 11:15:58 -07:00
Aaron Christy
8510a0bb5a Exclude _destroy parameter in :all_blank check (issue #2937) 2011-10-17 13:29:11 -04:00
Aaron Patterson
8919a68b96 Merge pull request #3334 from mperham/master
Default timestamps to non-null
2011-10-16 16:14:56 -07:00
Vishnu Atrai
9210458547 fix to remove warning in test cases 2011-10-16 14:29:06 +05:30
Mike Perham
3dbedd2823 Default timestamps to non-null 2011-10-14 21:09:53 -07:00
Christian Bäuerlein
410fa4cf7c Includes stale record in StaleObjectError 2011-10-14 16:28:02 +02:00
Jeremy Kemper
8cbe826958 Rails 4 is just around the corner. Stuck with 1.8 until then. 2011-10-13 16:11:00 -07:00
Jeremy Kemper
0a9b6de4d2 Tests gotta run in 1.8 too 2011-10-13 15:54:53 -07:00
David Heinemeier Hansson
85b64f98d1 Added ActiveRecord::Base.store for declaring simple single-column key/value stores [DHH] 2011-10-13 16:24:22 -05:00
Arun Agrawal
af7eeaafdb ambiguous first argument; put parentheses or even spaces Warning removed! 2011-10-10 14:16:45 +05:30
Jon Leighton
3456ef1119 Use broken YAML that will fail with Syck as well as Psych. Fixes test_broken_yaml_exception in fixtures_test.rb on Ruby 1.8.7.
Cherry-pick from 3-1-stable: b8d46924e70e0847e92e1d2dbaaec8c11381072c
2011-10-09 16:47:53 -07:00
Jeremy Kemper
8dba127188 Remove stray whitespace 2011-10-09 14:21:12 -07:00
Joseph Palermo
c90e5ce779 Only use LOWER for mysql case insensitive uniqueness check when column has a case sensitive collation. 2011-10-09 13:14:07 -07:00
Arun Agrawal
34d950b066 Fixed BodyProxy.new for tests! for wrong argument 2011-10-08 10:01:58 +05:30
Aaron Patterson
3088d23647 Merge pull request #3232 from Juanmcuello/pg_prepared_statements
Use the schema_search_path in prepared statements.
2011-10-06 20:08:05 -07:00
Jeremy Kemper
999b7ed94d Transactional fixtures enlist all active database connections.
You can use multiple databases in your tests without disabling transactional fixtures.
2011-10-05 19:10:18 -07:00
Jon Leighton
2e9e647fee Raise an exception on unknown primary key inside AssociationReflection.
An association between two models cannot be made if a relevant key is
unknown, so fail fast rather than generating invalid SQL. Fixes #3207.
2011-10-05 20:21:21 +01:00
Jon Leighton
64747654ca Revert "Raise error on unknown primary key."
This reverts commit ee2be435b1e5c0e94a4ee93a1a310e0471a77d07.
2011-10-05 20:21:21 +01:00
Juan M. Cuello
ac659b8ed3 refs #3232. Prepared statements and postgreSQL schemas.
Add tests for prepared statements with multiple schemas in
postgreSQL.
2011-10-05 14:44:50 -03:00
Jon Leighton
ee2be435b1 Raise error on unknown primary key.
If we don't have a primary key when we ask for it, it's better to fail
fast. Fixes GH #2307.
2011-10-05 01:11:40 +01:00
Yasuo Honda
b564ffcad4 To support ActiveRecord unit tests for IBM DB2 2011-10-02 22:51:01 -04:00