Commit Graph

5268 Commits

Author SHA1 Message Date
Noé Froidevaux
27c5800c9c Prevent multiple SHOW TABLES calls when a table don't exists in database. 2011-11-11 12:09:51 +01:00
Vijay Dev
6e112e4217 Modify change_table to remove the need for the block argument. 2011-11-11 02:47:27 +05:30
Vijay Dev
b805c71655 Checking the arity of the block passed to create_table
A recent change made to create_table does away with the
need for the block argument. Checking the arity will prevent the
mixing up of the two syntaxes.
2011-11-10 22:55:13 +05:30
Akira Matsuda
74c6e80cab exclude ORDER BY clause when querying Relation#exists? 2011-11-09 04:51:11 +09:00
Vijay Dev
cff1d751d0 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	railties/guides/source/active_record_querying.textile
2011-11-08 21:35:17 +05:30
Xavier Noria
17ecdd388c adds trailing +s to the output of EXPLAIN for MySQL 2011-11-07 02:01:56 -08:00
Akira Matsuda
aff9e68cb5 document fix: remove_column takes multiple column_names 2011-11-07 14:03:33 +09:00
Akira Matsuda
55b203dac1 self.up, self.down => up, down 2011-11-07 11:56:50 +09:00
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
9a111c7cf9 Use uniq instead of manually putting a DISTINCT in the query 2011-11-05 16:22:18 +00: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
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
567d454d99 Memoize through association 2011-11-03 13:24:39 +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
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
Vijay Dev
c809de8291 Merge branch 'master' of github.com:lifo/docrails 2011-10-30 14:47:23 +05:30
Aaron Patterson
4a065d56ed clear statement cache when tables are altered 2011-10-27 10:55:52 -07:00
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
Vijay Dev
ddce29bfa1 safeguard against configs missing environment or the database key 2011-10-26 00:41:41 +05:30
Joost Baaij
80bcfb00f7 Added a note that optimistic locking also needs a hidden field to function across web workers. 2011-10-25 13:57:24 +03:00
Xavier Noria
9dd168c402 minor revision to some new code in databases.rake 2011-10-24 14:46:28 +02:00
Xavier Noria
b064614ffb Merge pull request #2419 from dmitriy-kiriyenko/drop_test_database_in_development_when_running_rake_db_drop
When running "rake db:drop" also drop test database in development environment
2011-10-24 05:35:06 -07:00
Vijay Dev
8698debcc2 Merge branch 'master' of github.com:lifo/docrails 2011-10-23 01:38:37 +05:30
Vijay Dev
1c1c3fc2c0 minor fixes in the composed_of doc 2011-10-22 23:53:52 +05:30
Greg Reinacker
f092be821d preserve decimal column attributes after migration 2011-10-21 17:30:39 -06:00
Prem Sichanugrist
f0be2cb192 Add some note on adding index to HABTM table 2011-10-20 17:15:28 -04:00
Prem Sichanugrist
d64e0955d0 Use new migration style in HABTM join table
Yes, we're on Rails 3.1 now.
2011-10-20 17:13:01 -04: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
6a28c512e3 reset prepared statement when schema changes imapact statement results. fixes #3335 2011-10-18 11:20:13 -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
Mike Perham
3dbedd2823 Default timestamps to non-null 2011-10-14 21:09:53 -07:00
Vijay Dev
e759c8882a Merge branch 'master' of github.com:lifo/docrails 2011-10-14 22:21:40 +05:30
Christian Bäuerlein
c6f0461e89 Consider attempted action in exception message of ActiveRecord::StaleObjectError 2011-10-14 18:20:41 +02:00
Christian Bäuerlein
410fa4cf7c Includes stale record in StaleObjectError 2011-10-14 16:28:02 +02: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
Steve Bourne
e552fe16d4 change activerecord query conditions example to avoid 'type' as column name
'Type' is a reserved column for STI.  Changed conditions example to
avoid using that column name as an example.  The example isn't
STI-related (and mentioning STI here is needless clutter), so changing
to avoid accidentally encouraging users to use 'type' as a column name
for other purposes.
2011-10-12 10:46:08 -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