Commit Graph

5139 Commits

Author SHA1 Message Date
Aaron Patterson 22b01c52c7 isolating eager_loading? method 2010-11-30 16:10:49 -08:00
Aaron Patterson fe522f79c7 we already know it is already an array, so we do not need to make really really sure it is an array 2010-11-30 15:53:04 -08:00
Aaron Patterson ae6033331f shorten up scope_for_create 2010-11-30 15:48:15 -08:00
Aaron Patterson b293ab7c61 making sure scope_for_create value is cached 2010-11-30 15:45:32 -08:00
Aaron Patterson b2e7d1e41e surrounding scope_for_create behavior 2010-11-30 15:44:30 -08:00
Aaron Patterson 7ff980031b scope_for_create always returns something 2010-11-30 15:39:49 -08:00
Aaron Patterson dccf624b64 Ruby 1.8, how does it work? 2010-11-30 15:20:27 -08:00
Aaron Patterson c856e25b32 removing arel 1.0 compatibility 2010-11-30 14:56:53 -08:00
Aaron Patterson 3ad0779e56 testing combined nodes are not traversed 2010-11-30 14:56:32 -08:00
Aaron Patterson 795dc3d15f adding more tests surrounding where_values_hash 2010-11-30 14:47:55 -08:00
Aaron Patterson 6c32290bac testing Relation#table_name 2010-11-30 14:29:35 -08:00
Aaron Patterson bfc398cb70 adding a test for ActiveRecord::Relation 2010-11-30 14:10:55 -08:00
Aaron Patterson b7a9890d77 fix whitespace errors 2010-11-30 13:38:48 -08:00
Aaron Patterson 8998aea4b7 making relationship merge cheaper 2010-11-30 13:31:00 -08:00
Aaron Patterson b6848b6491 cleaning up where_values_hash 2010-11-30 12:05:02 -08:00
Aaron Patterson 76a15dd059 adding more tests surrounding where values hash 2010-11-29 16:41:02 -08:00
Aaron Patterson 9f2e885ce8 testing attributes applied by default_scope 2010-11-29 13:32:02 -08:00
Aaron Patterson aae3c35384 removing interpolate_sql from join associations 2010-11-29 10:58:21 -08:00
Aaron Patterson 439a7dc0e6 moving method to subclass that actually uses the method 2010-11-29 10:39:33 -08:00
John Hawthorn 28896a9f4a test case on has_one :through after a destroy
[#6037 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-29 10:48:48 +01:00
José Valim e444439fe2 Partialy revert f1c13b0dd7 2010-11-28 16:55:53 +01:00
Xavier Noria 9332cc582e removes a couple of redundant selfs 2010-11-26 00:35:23 +01:00
Santiago Pastorino 438c0188f8 nil check unneeded ht. exviva 2010-11-25 20:00:40 -02:00
Emilio Tagua a3bd62e1ba Remove explicit return.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:35:24 -02:00
Emilio Tagua c91a13f8f5 Use ternary instead explicit return.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:35:09 -02:00
Emilio Tagua ac6e9447e5 Remove return, we are already returning self.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:33:38 -02:00
Emilio Tagua 1b6b80355c Remove explicit return.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:33:18 -02:00
Emilio Tagua c4d31d0f13 Reuse lock_col variable instead calling locking_column class method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-25 17:32:16 -02:00
raggi cb1570936d Rakefiles are executables, and rake loads rake, not rakefile code 2010-11-25 06:49:55 +08:00
raggi d8692985fe Don't depend on rubygems loading thread (for Mutex) 2010-11-25 06:47:27 +08:00
Aaron Patterson ee74f2c623 alias should be a SQL literal 2010-11-24 14:16:38 -08:00
Aaron Patterson 38eb01863c initialize instance variables in initialize... o_O 2010-11-24 14:11:12 -08:00
Aaron Patterson 34d21b87bb adding a factory method to the join part for generating a table alias 2010-11-24 13:55:56 -08:00
Aaron Patterson cdf6cf01cb use ARel rather than generate SQL strings 2010-11-24 13:55:55 -08:00
Aaron Patterson afe51afcc6 remove useless join 2010-11-24 13:55:55 -08:00
Aaron Patterson d4b8d3bafa moving column_aliases to JoinDependency 2010-11-24 13:55:55 -08:00
Aaron Patterson a3ba60fd81 reduce method calls 2010-11-24 13:54:08 -08:00
Neeraj Singh 66212f69ac If a nested_attribute is being marked for destruction and at the same time an attr_accessor value is being assigned then the value being assigned is being ignored. This patch is a fix for that issue.
[#5939 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-24 22:08:36 +01:00
Franck Verrot 7f8ce38b0d Document the behavior of the dup method: does not preserve timestamps 2010-11-25 03:01:30 +08:00
Franck Verrot 7b77a1fc71 Typo in the comments of the clear_timestamp_attributes method 2010-11-25 03:01:30 +08:00
Franck Verrot c17cb7326d Dup should reset the timestamps as it is considered a new record 2010-11-25 01:18:43 +08:00
Franck Verrot 47f39d26a7 Testing that dup is resetting the timestamps 2010-11-25 01:18:43 +08:00
Aaron Patterson 0687b21de8 removing ternary 2010-11-23 17:52:51 -08:00
Aaron Patterson 1aaa8edeb9 breaking classes up in to respective files 2010-11-23 17:42:49 -08:00
Aaron Patterson a551d2ec62 fixing variable names. oops! 2010-11-23 17:42:49 -08:00
Aaron Patterson 8e8fb8a429 just wrap as a sql literal 2010-11-23 14:42:55 -08:00
Neeraj Singh d33dcba72d Do not send id for quoting twice if the primary key is string.
[#6022 state:resolved]
2010-11-23 14:33:00 -08:00
Aaron Patterson 0456feab11 updating changelog for dup and clone semantics 2010-11-23 14:29:05 -08:00
Aaron Patterson d717cb2913 clone and dup are working on 1.8 2010-11-23 14:29:05 -08:00
Aaron Patterson fe4388eb15 converting clone test to dup test 2010-11-23 14:29:05 -08:00
Aaron Patterson 064c28d6c2 fixing dup regressions 2010-11-23 14:29:05 -08:00
Aaron Patterson 93d78b8318 fixing more dup tests 2010-11-23 14:29:05 -08:00
Aaron Patterson 6a8f1b8b40 renaming duplication test to dup test 2010-11-23 14:29:04 -08:00
Aaron Patterson c5858a6df3 adding a specific case for clone testing 2010-11-23 14:29:04 -08:00
Aaron Patterson 28f4df0908 testing duped attributes are independent 2010-11-23 14:29:04 -08:00
Aaron Patterson 4c1f76eaab initialize_clone can go away 2010-11-23 14:29:04 -08:00
Aaron Patterson 035d00b665 making sure changes to dup will not touch original 2010-11-23 14:29:04 -08:00
Aaron Patterson 5badf60d12 dup keeps changes 2010-11-23 14:29:04 -08:00
Aaron Patterson ca7b0a0d1a dup is working better 2010-11-23 14:29:03 -08:00
Xavier Noria 85d64316a4 Merge branch 'master' of git://github.com/lifo/docrails 2010-11-23 21:59:50 +01:00
Emilio Tagua 9f35799221 Refactor && simplify count_records. 2010-11-23 09:51:07 -08:00
Emilio Tagua e2bad8a2e7 No need to create a variables to use them once. 2010-11-24 01:37:02 +08:00
Emilio Tagua d29d793c90 Don't create local vars. 2010-11-24 01:37:01 +08:00
Emilio Tagua 6ffe0ef55b Avoid creating local var. 2010-11-24 01:37:01 +08:00
Emilio Tagua 63c9185b62 Remove explicit return and avoid creating local var. 2010-11-24 01:37:01 +08:00
Emilio Tagua 1b531b7ee2 Remove explicit return. 2010-11-24 01:37:00 +08:00
Emilio Tagua b8df3a9197 Use params default. 2010-11-24 01:37:00 +08:00
Emilio Tagua 861cdc4c59 Remove unneeded local var. 2010-11-24 01:36:59 +08:00
Emilio Tagua 9c161599ac Remove uneeded local var definition. 2010-11-24 01:36:59 +08:00
Emilio Tagua a9e963d51d Remove confusing parenthesis. 2010-11-24 01:36:59 +08:00
Emilio Tagua 14055ea282 No need to define a local var here. 2010-11-24 01:36:59 +08:00
Ray Baxter de829f871b fix typo 2010-11-22 22:11:56 -08:00
Aaron Patterson dc320d5873 skip cloning if arguments are blank 2010-11-22 17:23:37 -08:00
Aaron Patterson 4ece7e06fd removing space error 2010-11-22 17:06:55 -08:00
Aaron Patterson 4d31ee1e0e removing unused variables 2010-11-22 16:14:37 -08:00
Alex Rothenberg 66c09372f3 Removed ids_in_list_limit in favor of in_clause_length defined in database_limits.rb 2010-11-23 06:43:18 +08:00
Neeraj Singh 5debc65c35 Merge branch 'master' of github.com:lifo/docrails 2010-11-22 17:32:27 -05:00
Neeraj Singh 1c68e55ae5 Revert "unscoped takes care of named_scopes too"
This reverts commit 126fbd7ed8.
2010-11-22 17:32:15 -05:00
Matthew Rudy Jacobs 16d7ba0698 Cleaner way to extract the Postgres version 2010-11-21 20:45:01 +08:00
Neeraj Singh c8ab3992f8 unscoped takes care of named_scopes too 2010-11-21 03:29:43 +01:00
Josh Kalderimis 8796f9a31a removed an AR method which wasn't used internally, had no tests, and had no docs
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-20 19:40:32 +01:00
Josh Kalderimis d7db6a8873 class inheritable attributes is used no more! all internal use of class inheritable has been changed to class_attribute. class inheritable attributes has been deprecated.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-11-20 19:40:29 +01:00
Matthew Rudy Jacobs d9ac62c914 Fix Bug: disable_referential_integrity doesn't work for postgres 9.0.1 2010-11-21 00:18:33 +08:00
Aaron Patterson 938243feb9 do not require ruby-debug automatically. please require it if you have declared it as a dependency 2010-11-19 16:26:09 -08:00
Aaron Patterson 6bd93f672a wtf vim 2010-11-19 11:48:23 -08:00
Aaron Patterson 598fc85f9e fisting typeo, thanks @vinibaggio 2010-11-19 11:42:58 -08:00
Aaron Patterson a4d9b1d329 adding documentation for reversible migrations 2010-11-19 11:34:42 -08:00
Aaron Patterson db32b545da adding Migration#change to the CHANGELOG 2010-11-19 11:20:02 -08:00
Aaron Patterson 87124457e5 fisting my spelling errors 2010-11-19 10:55:57 -08:00
Aaron Patterson 0cc6c46fe9 testing a non-invertible migration case 2010-11-19 10:50:24 -08:00
Aaron Patterson 47017bd169 invertable migrations are working 2010-11-19 10:31:03 -08:00
Aaron Patterson 6519df4157 command recorder will record commands sent to a delegate object 2010-11-19 10:24:16 -08:00
Aaron Patterson 6dbbfae563 adding invertable migration test 2010-11-19 10:24:16 -08:00
Aaron Patterson 0d7410faab updating documentation 2010-11-19 10:24:16 -08:00
Aaron Patterson 96b50a0392 IrreversibleMigration is raised if we cannot invert the command 2010-11-19 10:24:15 -08:00
Aaron Patterson b29a24bb6f commands are reversed 2010-11-19 10:24:15 -08:00
Aaron Patterson 5d93900dc6 add and remove timestamps can be inverted 2010-11-19 10:24:15 -08:00
Aaron Patterson 24b637a80f inverting add_index 2010-11-19 10:24:15 -08:00
Aaron Patterson 843e319f78 partial implementation of the command recorder 2010-11-19 10:24:15 -08:00
Aaron Patterson 24174d1b3a this return value is not used, so stop returning it 2010-11-19 10:23:13 -08:00
Aaron Patterson 9280fbf795 instantiate the delegate object after initialize is defined so that our initialize method actually gets called 2010-11-19 10:14:13 -08:00
Aaron Patterson 07a74f196d connection is set from the connection pool during migrations 2010-11-18 15:53:59 -08:00
Aaron Patterson e107dcca6b testing multiple ORd queries 2010-11-18 13:39:57 -08:00
Aaron Patterson 26923756fb removing space errors 2010-11-18 10:01:29 -08:00
Alex Rothenberg c5a284f8eb Adapters can specify maximum number of ids they support in a list of expressions
(default is nil meaning unlimited but Oracle imposes a limit of 1000)
Limit is used to make multiple queries when preloading associated has_many or habtm records
2010-11-18 09:59:52 -08:00
Neeraj Singh 126fbd7ed8 unscoped takes care of named_scopes too 2010-11-17 21:46:55 -05:00
Aaron Patterson 80d9b724c3 group can be done by left side only 2010-11-17 17:28:40 -08:00
Santiago Pastorino c6bfd6802a When use where more than once on the same column, relation doesn't do an 'or' or 'in' with the values 2010-11-17 17:15:25 -08:00
Aaron Patterson 00693209ec collapsing same table / column WHERE clauses to be OR [#4598 state:resolved] 2010-11-17 17:10:50 -08:00
Aaron Patterson 56c5820458 use shorter form for sql literals 2010-11-17 16:15:52 -08:00
Jon Leighton fe42c00ac3 Fix bug with 0bb85ed9ff which missed out a fixtures declaration in cascaded_eager_loading_test.rb 2010-11-17 15:52:18 -08:00
Neeraj Singh 9c1993bf6b replace and with && as per rails coding convention 2010-11-18 07:49:45 +08:00
Neeraj Singh f978c4b2e4 remove the rescue block by returning a not asking Base for lookup_ancestors. It was also marked for later optimization. 2010-11-17 15:44:04 -08:00
Aaron Patterson 43e2e10f4f adding an initialize with name and version defaults 2010-11-17 15:30:09 -08:00
Aaron Patterson 4d35f8b661 updating generators 2010-11-17 14:57:54 -08:00
Aaron Patterson c1a63c8dba fixing more documentation 2010-11-17 14:57:54 -08:00
Aaron Patterson d1fcba8118 fixing documentation, removing unused AS files 2010-11-17 14:57:54 -08:00
Aaron Patterson 7906e08bba fixing indentation since these methods are not class methods 2010-11-17 14:57:54 -08:00
Aaron Patterson 606e41a4dd these methods are no longer needed 2010-11-17 14:57:54 -08:00
Aaron Patterson 17c7723451 updating CHANGELOG 2010-11-17 14:26:35 -08:00
Aaron Patterson b0a6f58068 do not need these accessors 2010-11-17 14:26:35 -08:00
Aaron Patterson 68b66ef308 testing instance based migrations 2010-11-17 14:26:35 -08:00
Aaron Patterson 974ff0dd43 singleton method added is no longer needed 2010-11-17 14:26:35 -08:00
Aaron Patterson 0bea9fd6be schema migrations work as instances 2010-11-17 14:26:34 -08:00
Aaron Patterson 8b2f801ed8 converted migrations to support instance methods 2010-11-17 14:26:34 -08:00
Aaron Patterson 77440ec51a fixing assertions so error messages will be more helpful 2010-11-17 13:02:03 -08:00
Carl Lerche ccd2f3ede5 Update the version.rb files to include a PRE part 2010-11-16 17:19:46 -08:00
Aaron Patterson 2738ec891b removing many unused variables 2010-11-16 17:06:50 -08:00
Aaron Patterson 08c64bbd39 super automatically passes on the implicit block 2010-11-16 14:28:19 -08:00
Aaron Patterson 05320e3788 use unless instead of if ! 2010-11-16 14:28:19 -08:00
Aaron Patterson 5f608fc7c4 removing space errors 2010-11-16 14:28:19 -08:00
Aaron Patterson c801f233df reloading an association will properly set attributes of instantiated objects. Thanks Brian Palmer [#5802 state:resolved] 2010-11-16 14:28:19 -08:00
Aaron Patterson 59ba800698 refactoring uniq method 2010-11-16 13:34:18 -08:00
Aaron Patterson 7ebd36d1c4 refactor to reduce method calls 2010-11-16 11:43:11 -08:00
Alexandru Catighera a5cdf0b9eb Fix ActiveRecord calculations when grouped by multiple fields 2010-11-16 10:38:47 -08:00
Piotr Sarnacki 437ceab139 Create directory before copying migrations if it does not exist 2010-11-16 17:00:01 +01:00
Xavier Noria a820d0afdd revises RDoc of AR::Base#== 2010-11-16 15:58:37 +01:00
Santiago Pastorino 4718d097ff Models should be equals even after destroyed
[#5978 state:committed]
2010-11-16 12:40:40 -02:00
Aaron Patterson ace84a003c support finding by a ruby class [#5979 state:resolved] 2010-11-15 20:25:43 -08:00
Aaron Patterson 7bf9cbb766 adding more test coverage around finding with active record objects 2010-11-15 15:30:58 -08:00
Aaron Patterson dcdfc84f55 use quoted id of single AR::Base objects in predicates 2010-11-15 14:35:38 -08:00
Neeraj Singh 7c5c1a07c0 if association is already loaded and if a find operation is performed on the already loaded association list with an empty hash then do not perform another sql
[#5972 state:resolved]
2010-11-15 10:12:23 -08:00
Aaron Patterson 022519a032 fisting a bunch of unused variable warnings 2010-11-15 10:12:09 -08:00
Santiago Pastorino bc556a21e2 Remove unused var 2010-11-14 15:34:07 -02:00
Jason Cheow 93c9f4a942 Fix bug where size of through association is not correct after adding a has_many association (occurs only before main object has been reloaded).
[#5968 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-14 15:32:52 -02:00
Franck Verrot 983976ec54 Finder gives a little bit more info on the lookup column (primary key) 2010-11-13 06:32:08 +08:00
Santiago Pastorino b734e192a7 present? is better here 2010-11-11 19:00:33 -02:00
José Valim f912a359aa Merge remote branch 'drogus/plugin_new'
Conflicts:
	railties/test/generators/app_generator_test.rb
2010-11-11 19:39:21 +01:00
Franck Verrot de2933e1a0 STI type is now updated when calling AR::Base.becomes on subclasses [#5953 state:resolved] 2010-11-12 02:17:34 +08:00
Santiago Pastorino 296e5c38f1 Use ! instead of not 2010-11-11 15:24:49 -02:00
Santiago Pastorino 894fd28859 Fixed bug in active_record/nested_attributes where an empty string id caused an ActiveRecord::RecordNotFound error. Found by [Ben Tillman]
[#5638 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-11 15:23:40 -02:00
Santiago Pastorino ceef719924 Bump Arel up to 2.0.2 2010-11-11 15:05:12 -02:00
José Valim 9c9f416d39 Allow AR Session Store to be renewed 2010-11-11 14:17:14 +01:00
Xavier Noria 41366cdec6 syncs CHANGELOGs for 3.0.2 in 3-0-stable with the ones in master 2010-11-09 20:56:41 +01:00
Santiago Pastorino 88a559d414 Double negation of an already boolean value produces the same result 2010-11-09 16:53:03 -02:00
Santiago Pastorino 75dfd95618 Don't check if persisted is defined just initialize it properly 2010-11-09 16:00:02 -02:00
Santiago Pastorino 994a1c2a47 Execute less operations 2010-11-09 14:03:09 -02:00
David Chelimsky 1f06652a57 use persisted? instead of new_record? wherever possible
- persisted? is the API defined in ActiveModel
- makes it easier for extension libraries to conform to ActiveModel APIs
  without concern for whether the extended object is specifically
  ActiveRecord

[#5927 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-09 13:54:04 -02:00
Michael Koziarski 3d6eea0221 Update the validates_uniqueness_of documentation to tell you to use a unique index.
The other options mentioned were not good ideas and disclaimed as such in the documentation.
2010-11-08 10:16:40 +13:00
Raimonds Simanovskis 6709078eb1 use column names as order by complex function parameters, fix for postgresql adapter to correctly remove ASC/DESC
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-11-07 09:55:17 -02:00
Aaron Patterson 1acc086278 reduce duplication in assiciations #construct() 2010-11-06 18:20:08 -07:00
Aaron Patterson c11102d4f8 make sure we keep parent records in order 2010-11-06 14:32:41 -07:00
Aaron Patterson 39a8056791 only call to_s on the association variable once 2010-11-05 17:08:56 -07:00
Aaron Patterson c43d909ee2 simplify instantiate in the join parts object 2010-11-05 16:56:50 -07:00
Aaron Patterson d89d702361 index is not used, so removing it 2010-11-05 16:56:50 -07:00
Aaron Patterson a79e1de90a reduce method calls to the join base object 2010-11-05 16:56:50 -07:00
Aaron Patterson 06d518a323 stop recursively calling exists? 2010-11-05 15:36:36 -07:00
Santiago Pastorino 00261a187e Avoid warning: shadowing outer local variable 2010-11-05 16:34:23 -02:00
Santiago Pastorino 3146aa68fd Fixes queries using limits and punctuation in order, removes order("col1, col2") usage in favor of order(["col1", "col2"})
[#4597 state:committed]
2010-11-05 11:27:34 -07:00
Aaron Patterson d5e45931a0 renaming exec in the mysql adapter 2010-11-05 10:21:14 -07:00
Aaron Patterson 0f45f23669 renaming exec in the PG adapter 2010-11-05 10:15:33 -07:00
Aaron Patterson 9a08517c8d converted exec to exec_query for sqlite 2010-11-05 10:08:38 -07:00
sblackstone 710dcf826a Association Proxy should not undefine the default respond_to_missing 2010-11-04 15:02:27 -07:00
Aaron Patterson fa4686243c ignoring certain SQL when using Oracle 2010-11-03 17:34:49 -07:00
Aaron Patterson 6367e95867 select goes through exec(), so no method chaining for query counts 2010-11-03 17:34:49 -07:00
Aaron Patterson 5c6978608d use bind params in select with query monkeypatch 2010-11-03 17:34:49 -07:00
Piotr Sarnacki cfbe595831 Use application's generators defaults as engine defaults to not force users to manually set it 2010-11-02 17:14:52 +01:00
Pratik Naik 18b6aa6538 Make should_record_timestamps? serialization aware rather than object#changed? 2010-11-02 01:45:30 +00:00
Pratik Naik e911ed1f0f Ensure save always updates timestamps when serialized attributes are present 2010-11-02 01:42:49 +00:00
Pratik Naik c5c2e4fefd Add timestamps to Topic 2010-11-02 01:24:31 +00:00
Aaron Patterson 296467fcc4 only returning where values for the corresponding relation, also filtering where value hash based on table name [#5234 state:resolved] [#5184 state:resolved] 2010-10-30 13:25:49 -07:00
Aaron Patterson cbca12f908 adding tests for #5234 and #5184. Tests were from Akira Matsuda. Thanks Akira! 2010-10-30 13:20:54 -07:00
Aaron Patterson 7d5762d2c2 no need to merge where values if no new where values have been added 2010-10-30 12:28:49 -07:00
Denis Odorcic cc9742920c Convert :primary_key in association to a string before comparing to column names, so that for example :primary_key => :another_pk works as well [#5605 state:resolved] 2010-10-30 11:24:36 -07:00
Aaron Patterson 67a3a70295 refactoring find_join_association 2010-10-30 08:45:40 -07:00
Ernie Miller 0bb85ed9ff Fix issues when including the same association multiple times and mixing joins/includes together. 2010-10-30 06:48:44 -07:00
Jon Leighton b82fab25f9 Refactoring: replace the mix of variables like @finder_sql, @counter_sql, etc with just a single scope hash (created on initialization of the proxy). This is now used consistently across all associations. Therefore, all you have to do to ensure finding/counting etc is done correctly is implement the scope correctly. 2010-10-30 06:30:00 -07:00
Aaron Patterson 2a47e7ef10 only do string substitution on column names once, remove intermediate data structures 2010-10-30 06:16:54 -07:00
Aaron Patterson 2e07260f36 columns are always strings 2010-10-30 06:12:50 -07:00
Aaron Patterson 6cf44a1bd6 no need to to_i, sqlite does that for us 2010-10-30 06:11:06 -07:00
Aaron Patterson 6a3d6b7f13 select_all() should always return an array, so no need to test 2010-10-27 14:39:24 -07:00
Aaron Patterson f6ddb3553a fisting test name 2010-10-27 14:33:02 -07:00
Aaron Patterson 9ce0211806 speeding up query cache 2010-10-27 14:23:01 -07:00
Aaron Patterson 7104122cc3 making query cache work with prepared statements 2010-10-27 14:05:40 -07:00
Aaron Patterson e73b0b84d9 renaming bind_values to binds where it makes sense 2010-10-26 13:44:11 -07:00
Aaron Patterson 104d0b263e adding backwards compatibility for non-prepare statement handling drivers 2010-10-26 13:44:11 -07:00
Aaron Patterson fca229e205 caching column values 2010-10-26 13:44:11 -07:00
Aaron Patterson 02128d628c setting the authorized session clears the statement cache 2010-10-26 13:44:11 -07:00
Aaron Patterson 9d9aed433b add a session authorization setter to the pg connection 2010-10-26 13:44:11 -07:00
Aaron Patterson 1741bbe2d5 avoiding statement cache if there are no bind values 2010-10-26 13:44:10 -07:00
Aaron Patterson 28a18b5988 folding async_exec to exec 2010-10-26 13:44:10 -07:00
Aaron Patterson 03e4ea5290 clear cache before resetting the connection 2010-10-26 13:44:10 -07:00
Aaron Patterson 1b4e0b6542 prepare the statement before we cache the key 2010-10-26 13:44:10 -07:00
Aaron Patterson 43bbb25ddd bind substitution is working properly 2010-10-26 13:44:10 -07:00
Aaron Patterson 9d46e0d012 bind parameters are now typecast 2010-10-26 13:44:10 -07:00
Aaron Patterson e2813479f9 basic bind parameters are working 2010-10-26 13:44:09 -07:00
Aaron Patterson ffb999125a initial exec() method is working in pg adapter 2010-10-26 13:44:09 -07:00
Aaron Patterson eb83eb6c98 monkey patching with enumerable so we can call each 2010-10-26 13:44:09 -07:00
Aaron Patterson fe2ee4fafd monkey patching Mysql::Stmt, calling free on the metadata 2010-10-26 13:44:09 -07:00
Aaron Patterson ee959a9ca1 free the result after slurping 2010-10-26 13:44:09 -07:00
Aaron Patterson efc10a8a64 eliminating some calls to execute() 2010-10-26 13:44:09 -07:00
Aaron Patterson 050d7d3e49 statements are cached, cache is cleared on reconnect 2010-10-26 13:44:09 -07:00
Aaron Patterson d4b0bcb88e all mysql tests are passing 2010-10-26 13:44:09 -07:00
Aaron Patterson d6b16bbaf7 one more mysql test left! 2010-10-26 13:44:09 -07:00
Aaron Patterson 77b1193ac1 mysql tests are mostly passing 2010-10-26 13:44:08 -07:00
Aaron Patterson 9c7e2e4117 find_one uses prepared statement cache 2010-10-26 13:44:08 -07:00
Aaron Patterson 5abebfb569 clearing statements on disconnect and reset 2010-10-26 13:44:08 -07:00
Aaron Patterson 54ff59f3ba refactoring tests 2010-10-26 13:44:08 -07:00
Aaron Patterson d7207cf504 type casting bound value based on column associated with value 2010-10-26 13:44:08 -07:00
Aaron Patterson 76d0805786 stop calling execute directly on the database connection 2010-10-26 13:44:08 -07:00
Aaron Patterson 77d548a6d3 removing another execute 2010-10-26 13:44:08 -07:00
Aaron Patterson 7023d73f26 removing more execute calls 2010-10-26 13:44:08 -07:00
Aaron Patterson e60fecd829 removing more calls to execute 2010-10-26 13:44:08 -07:00
Aaron Patterson 853d39e854 removing some uses of execute 2010-10-26 13:44:07 -07:00
Aaron Patterson cc468d3ec8 exec returns an AR::Result 2010-10-26 13:44:07 -07:00
Aaron Patterson 6ceffb8178 adding bind_values to relations 2010-10-26 13:44:07 -07:00
Aaron Patterson 497218d5db adding bind value substitution 2010-10-26 13:44:07 -07:00
Aaron Patterson ef0cf143a9 adding the abstract method 2010-10-26 13:44:07 -07:00
Aaron Patterson c376fd488c Revert "removing unused variable"
This reverts commit 3e4ede81d6.
2010-10-26 13:43:06 -07:00
Aaron Patterson f61f758761 reducing the number of parameters to select() 2010-10-26 13:43:06 -07:00
Aaron Patterson 5685a5c41c refactor to remove `through_records` 2010-10-23 20:29:46 -07:00
Aaron Patterson 6c998a79c8 removing dead code 2010-10-23 20:29:46 -07:00
Aaron Patterson 3e4ede81d6 removing unused variable 2010-10-23 20:29:46 -07:00
Aaron Patterson ee71a3fbfc removing call to deprecated API, this test is outside AR responsibilities 2010-10-22 13:33:59 -07:00
Aaron Patterson 1ce76db918 if it responds to :usec, it should also "act like" a time 2010-10-22 13:31:44 -07:00
Aaron Patterson 40491b4654 removing space errors 2010-10-22 10:35:08 -07:00
Xavier Noria a031fc57c8 made a pass in AR's schema.rb to keep (most) create statements in lexicographic order, and fixed an FK 2010-10-22 16:55:02 +02:00
Xavier Noria 5b86c3e5bb has_one maintains the association with separate after_create/after_update
This way parent models can get their own after_create and
after_update callbacks fired after has_one has done its job.
2010-10-22 10:28:53 +02:00
Aaron Patterson 410114e85a adding a test to ensure offsets with no limits will work [#5316 state:resolved] 2010-10-20 17:17:22 -07:00
Aaron Patterson 828bb94d5a use grep instead of select + is_a? 2010-10-20 16:41:50 -07:00
Aaron Patterson 4be0fc124a use a map and flatten to avoid << calls on array 2010-10-20 16:20:49 -07:00
Aaron Patterson 784177aeee only call `column_methods_hash` once, use array math for faster test of existence 2010-10-20 16:17:15 -07:00
Aaron Patterson 7f444a3db6 roll up weird method to meta programmed method 2010-10-20 15:51:44 -07:00
Aaron Patterson fb835fc1e2 use zip + Hash.[] rather than looping with an index 2010-10-20 15:46:04 -07:00
Aaron Patterson 954bd126ec extract options is not necessary 2010-10-20 15:07:17 -07:00
Aaron Patterson 03d4b86e78 removing unused variable 2010-10-20 14:58:16 -07:00
Aaron Patterson 96e8e97e78 removing unused variables 2010-10-20 09:38:15 -07:00
Jan 21beedf1ff default scope merge where clauses [#5488 state:resolved] 2010-10-20 09:00:36 -07:00
Aaron Patterson dbc5d2694f reduce duplicate where removal to one loop 2010-10-20 08:41:25 -07:00
Aaron Patterson 8c511c0b3c swap out some n^2 for some n 2010-10-19 20:53:53 -07:00
Aaron Patterson 8d5829f149 dup rather than create so many arrays 2010-10-19 17:51:46 -07:00
Aaron Patterson dc16163d06 use array math rather than looping through the array 2010-10-19 17:46:54 -07:00
Aaron Patterson c56fea2be4 use shortened version to generate a sql literal 2010-10-19 17:44:33 -07:00
Aaron Patterson 08636527b5 avoid cloning if we do not need to clone 2010-10-19 17:44:07 -07:00
Aaron Patterson 78b6f64105 avoid creating a proc object when possible 2010-10-19 17:37:55 -07:00
Aaron Patterson d2898d4ef8 scopes can take an object that responds to `call` 2010-10-19 17:29:25 -07:00
Aaron Patterson 56be4c897a avoid creating the proc object if possible 2010-10-19 17:29:25 -07:00
Aaron Patterson e68f339aae default scope can accept any object that responds to #call 2010-10-19 15:07:44 -07:00
Tim Morgan b1b26af9a2 Allow default_scope to accept a Proc. 2010-10-19 14:43:31 -07:00
Anil Wadghule d7799fadf9 Fix SQLite adapter name [#5842 state:resolved] 2010-10-19 10:44:59 -07:00
Aaron Patterson 1856e975c3 "instance_methods" includes public and protected 2010-10-19 08:30:45 -07:00
Michał Łomnicki 4120e95dce Use ALTER INDEX syntax to rename an index 2010-10-19 08:40:28 +08:00
Santiago Pastorino 460c4efd71 Merge CHANGELOGs from 3-0-stable 2010-10-18 12:24:41 -02:00
Santiago Pastorino 67df21f895 No need for parenthesis here 2010-10-17 12:34:51 -02:00
Neeraj Singh f527f9097b no need to check for nil
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-17 12:26:47 -02:00
Neeraj Singh ea14396c45 replace if ! with unless
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-10-17 12:26:32 -02:00
Aaron Patterson dc76e3c38f should sort these ids before asserting they are equal! 2010-10-15 15:47:09 -07:00
Aaron Patterson 552636c652 testing that symbols work as sql literals 2010-10-15 15:46:13 -07:00
Xavier Noria 21ff8849bb in regexps, the dot in a character class is not a metacharacter 2010-10-15 16:31:00 +02:00
Carl Lerche 69789c3b29 #transaction on the instance level should take options as well 2010-10-14 21:27:40 -07:00
Michael Koziarski 9ebe582830 Revert 0c0b0aa0f2 which introduced a security vulnerability.
This addresses  CVE-2010-3933

Conflicts:

	activerecord/lib/active_record/nested_attributes.rb
2010-10-15 10:27:33 +13:00
Xavier Noria 13f7f89bda Merge branch 'master' of git://github.com/lifo/docrails 2010-10-14 23:15:23 +02:00
Piotr Sarnacki f07cbec865 Do not treat information about skipped migrations as WARNINGs but as a NOTEs, also puts to stdin 2010-10-14 07:46:12 +02:00
Aaron Patterson 676a00163d clear any stale connections before messing with threaded tests 2010-10-13 16:58:03 -07:00
Carl Lerche 91ba75806f Update the ActiveRecord tests to not set unused options
This makes a test fail, but it is revealing a bug in Arel master.
2010-10-13 12:32:52 -07:00
Rafael Mendonça França aec5ef243a Remove doc for debugging callbacks. Methods don't exist in Rails master 2010-10-13 15:59:57 -03:00
Carl Lerche 0b6af35ef0 Update the PostgreSQL adapter documentation 2010-10-13 11:49:32 -07:00
Carl Lerche 941844cbe5 rb_thread_select should always be used in DB drivers when available. 2010-10-13 11:40:47 -07:00
Jon Leighton 1ddbb216ea Delete unused methods in JoinAssociation 2010-10-13 08:24:19 -07:00
Jon Leighton 19304a9758 Renaming and formatting changes in JoinDependency 2010-10-13 08:24:19 -07:00
Jon Leighton 7dcb633427 Refactor JoinDependency and friends so that a JoinAssociation can produce an arbitrary number of joins, which will be needed in order to support nested through associations. 2010-10-13 08:24:19 -07:00
Jon Leighton 076b75bf98 Add some tests for functionality in JoinAssociation which already exists but was previously untested 2010-10-13 08:24:19 -07:00
Aaron Patterson 603406dc53 stop using deprecated arel API 2010-10-12 14:33:16 -07:00
Aaron Patterson 25a2909355 dry up column type testing 2010-10-12 13:13:19 -07:00
Aaron Patterson 4b2e16ed24 all columns respond to string_to_binary, so no need to check respond_to? 2010-10-12 13:10:52 -07:00
Aaron Patterson 5b5ae01f29 drying up true and false cases 2010-10-12 11:59:20 -07:00
Aaron Patterson 01893f43f6 reducing comparisons in when statements 2010-10-12 11:55:52 -07:00
Aaron Patterson 9852a72417 removing intermediate variables 2010-10-12 11:48:41 -07:00
Aaron Patterson c882154cd1 reduce the number of times we test for the column variable 2010-10-12 11:45:59 -07:00
Aaron Patterson 0ca9c836c0 test quoting a string with an unknown column type 2010-10-12 11:43:50 -07:00
Aaron Patterson 31b132aa9b refactoring date / time / datetime when statement 2010-10-12 11:41:23 -07:00
Aaron Patterson ef11ce2af8 fixing case / when indentation 2010-10-12 11:38:40 -07:00
Aaron Patterson 98cb754cd7 test quoting multibyte chars object 2010-10-12 11:38:07 -07:00
Aaron Patterson 2681dd81b4 test quoting strings with binary columns 2010-10-12 11:34:21 -07:00
Aaron Patterson 4804cb485c test quoting a string with a float column 2010-10-12 11:30:34 -07:00
Aaron Patterson 50ad7f6561 testing quoting a string for an int column 2010-10-12 11:29:28 -07:00
Aaron Patterson 07b0b5b330 testing crazy object quoting 2010-10-12 11:25:20 -07:00
Aaron Patterson 1ba3489b75 test that dates / times / datetimes call quoted_date 2010-10-12 11:21:35 -07:00
Aaron Patterson 8b33f66891 test quoting of bigdecimals 2010-10-12 11:08:10 -07:00
Aaron Patterson ba0a6772bb testing floats, fixnum, and bignums 2010-10-11 17:57:47 -07:00
Aaron Patterson 8e8a5f33f4 test quoting nils, true, false, id 2010-10-11 17:52:10 -07:00
Aaron Patterson 2610bcbd94 getting quoted_time under more specific tests 2010-10-11 17:52:10 -07:00
Aaron Patterson b9d4341bd0 starting to get the quote module under test 2010-10-11 17:52:10 -07:00
Aaron Patterson cecccf1156 we should always cast the value based on the column 2010-10-11 13:35:58 -07:00
Aaron Patterson bef5b826e3 removing freeze 2010-10-11 13:02:36 -07:00
Marcelo Giorgi 1c9022de21 Honor distinct option when used with count operation after group clause [#5721 state:resolved] 2010-10-11 09:39:34 -07:00
Santiago Pastorino e0b76d6151 reorder removed in favor of except(:order).order 2010-10-11 11:54:46 -02:00
Xavier Noria 21a92b8d01 Merge branch 'master' of git://github.com/lifo/docrails 2010-10-11 12:06:21 +02:00
José Valim a8b1780410 Updated DOCS for engines and added a couple TODOs. Also, commented internal railties rake tasks description. 2010-10-11 10:29:31 +02:00
Nathan Zook and Ryan Bigg 9074e8c644 Updated RUNNING_UNIT_TESTS documentation with mention of the build_databases rake tasks. 2010-10-11 11:15:38 +11:00
wycats cc8e386d08 Always pull in version for frameworks (standardize autoload / require / none) 2010-10-10 16:12:04 -07:00
Piotr Sarnacki 8636f64def Rename rake railties:copy_migrations to rake railties:install:migrations and fix it to work with new copying strategy 2010-10-09 21:32:34 +02:00
Piotr Sarnacki 022205be1d Add callback on skipped migration while copying migrations 2010-10-09 21:32:34 +02:00
Piotr Sarnacki 4377f8eba2 Change the method for copying migrations, do not add scope.
The purpose of this change is to allow copying fail on the same names.
Migrations change database and they should be treated with caution,
if 2 migrations are named the same it's much better to skip migration
and allow user decide if it should be copied or not.
2010-10-09 21:32:34 +02:00
Aaron Patterson 740d7e5aa2 removing false comment 2010-10-07 16:40:15 -06:00
Xavier Noria db520042b3 Merge branch 'master' of git://github.com/lifo/docrails 2010-10-06 23:16:13 +02:00
Hemant Kumar 2a04110f26 fix ruby 1.9 deadlock problem, fixes #5736 add connection pool tests 2010-10-06 14:45:56 -06:00
José Valim d649bf158b Provide a cleaner syntax for paths configuration that does not rely on method_missing. 2010-10-06 17:20:15 +02:00
Aaron Patterson e7d860c6be create fewer objects, call fewer methods in extract_pg_identifier_from_name 2010-10-04 15:25:20 -07:00
Aaron Patterson d8135eb452 * + flatten is not required in >= Ruby 1.8.7 2010-10-04 15:19:27 -07:00
Aaron Patterson 69a2c6b041 converting inject([]) to map 2010-10-03 16:42:08 -07:00
Aaron Patterson 365c93b7cd speed up duplicate migration detection 2010-10-03 16:39:48 -07:00
Aaron Patterson 40761c4bf3 reduce the number of calls to camelize 2010-10-03 16:36:43 -07:00
Aaron Patterson e6583901e5 convertion MigrationProxy to a Struct, initialize instance variables 2010-10-03 16:32:27 -07:00
Aaron Patterson 341e71a1b9 dry up some migration logic 2010-10-03 16:23:07 -07:00
Aaron Patterson 8beda11fd3 no need to differentiate between nil and false in this case 2010-10-03 16:13:45 -07:00
Aaron Patterson 5154a464cc lengths will be nil or an array 2010-10-03 15:35:56 -07:00
Aaron Patterson 7836616a64 remove a few function calls 2010-10-03 15:18:32 -07:00
Aaron Patterson bd78d24bd8 be kind to the garbage collector and reuse our visitor object 2010-10-03 14:40:06 -07:00
Aaron Patterson 83633b807a avoid creating objects when we can 2010-10-03 14:40:06 -07:00
José Valim 50215f9525 Rely on Rack::Session stores API for more compatibility across the Ruby world. 2010-10-03 21:24:22 +02:00
Carlos Antonio da Silva 4e93179ed3 Refactor AssociationCollection#include? with objects in memory
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-02 08:40:38 +02:00
Evgeniy Dolzhenko ee31847a5a Fix serialization :include option name 2010-10-01 14:26:17 +04:00
Aaron Patterson 45edeed1ee Arel::Sql::Engine.new does not do anything anymore 2010-09-30 16:28:12 -07:00
Aaron Patterson 0238228e5d type_name should check for blank because people may have messed up databases 2010-09-30 16:03:05 -07:00
Aaron Patterson 15419a5dc6 build_where should be private 2010-09-30 14:37:09 -07:00
Aaron Patterson fb4ee9c7e5 type_name is never a blank string, so use faster .nil? call 2010-09-30 14:37:04 -07:00
Marcelo Giorgi ef6df93a8d AssociationCollection#include? working properly for objects added with build method [#3472 state:resolved] 2010-09-30 12:13:52 -07:00
Aaron Patterson 505b532605 speeding up object instantiation by eliminating instance_eval 2010-09-30 12:13:12 -07:00
Aaron Patterson a8a62f87f6 [#5441 state:resolved] refactoring code to determine aggregate column 2010-09-30 10:17:38 -07:00
Aaron Patterson cc18034c8c group clause must be more specific 2010-09-30 10:17:34 -07:00
oleg dashevskii ab9622ee62 Tests proving #5441 2010-09-30 10:17:29 -07:00
yalab 91deff08c9 Fix 'rake db:create' is ignore encoding when using postgres [#5717 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-30 13:53:06 -03:00
Piotr Sarnacki f851352318 Added config.app_generators to allow configuring application's generators from railties.
With config.generators becomes a way to configure generators
for current instance only. For example:

module Blog
  class Engine < Rails::Engine
    config.generators do |g|
      g.orm :active_record
    end

    config.app_generators do |g|
      g.test_framework :rspec
    end
  end
end

such definition sets :active_record as orm for engine and :rspec
as test_framework for application. The values set with app_generators
can be overwritten in application using config.generators as you would
normally do:

module MyApp
  class Application < Rails::Application
    config.generators do |g|
      g.test_framework :test_unit
    end
  end
end
2010-09-30 09:47:06 +02:00
Neeraj Singh 396f3a28f1 double negative is not good 2010-09-30 08:11:36 +08:00
Neeraj Singh 299e9f6927 no need of nil check 2010-09-29 16:43:00 -07:00
Emilio Tagua 61cf11247b Use detect instead select to avoid "sh: [mysqldump]: command not found".
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-29 20:29:51 +02:00
Aaron Patterson 5793d5e002 eliminating method_missing on TableDefinition 2010-09-29 11:18:43 -07:00
Aaron Patterson b9215273a9 DRY up postgresql quote logic 2010-09-29 10:36:33 -07:00
Aaron Patterson 4350a5c73f fixing where clause indentation 2010-09-29 10:36:33 -07:00