Commit Graph

2220 Commits

Author SHA1 Message Date
Aaron Patterson
e1b51955f1 adding a test for slug behavior 2010-09-27 11:33:35 -07:00
Tim Connor
d6f7b7d353 Fix remove_index issue when provided :name is a symbol
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-26 20:40:14 -03:00
Marcelo Giorgi
72543b2e63 Delegate ActiveRecord::Base.offset to scoped methods (analogous to limit) [#5688 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-24 20:24:54 -03:00
tnp
55b6fa9370 restore behavior of touch for models without :updated_xx [#5439 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 20:42:38 +02:00
Neeraj Singh
097240f602 reject_id option should be respected while using nested_attributes
[#5579 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 12:46:24 +02:00
Aaron Patterson
afdf86e8ee Hash#to_s behaves differently between 1.8 and 1.9, so adjust accordingly 2010-09-23 08:48:10 -07:00
Aaron Patterson
0a515dc68d testing poor behavior of hash serialization 2010-09-22 14:58:29 -07:00
Aaron Patterson
b7e4a97ab5 fixing tests. woo 2010-09-21 14:42:28 -07:00
Hemant Kumar
953d129bb2 remove join table rows before removing owner row for habtm associations, fixes#5674 2010-09-21 13:58:09 -07:00
Aaron Patterson
96bd936b64 providing arel with column information when possible [#5392 state:resolved] 2010-09-21 13:53:47 -07:00
Emilio Tagua
d64a09b443 Remove helper methods that were moved to helper.rb
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-21 15:18:12 +02:00
Emilio Tagua
ae24ce52ae Move helper methods to helper.rb. Make test not depend on local TZ to pass or fail.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-21 15:07:43 +02:00
Tim Connor
37de59eacf Fix issue with remove_index and add unit test [#5645 state:resolved] 2010-09-18 20:49:31 +02:00
Neeraj Singh
9401fa0b9c expanding the test to include both type of order declaration
while declaring default_scope

Also added test for unscoped using block style with four different
combinations

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-18 20:49:19 +02:00
Aaron Patterson
3480551e67 removing nonsensical tests, limit now actually adds a limit 2010-09-15 14:18:16 -07:00
Aaron Patterson
a11dd8ac87 specific number of spaces should not be enforced 2010-09-10 11:51:32 -07:00
kane
1c283765b6 added a test for relation which checks intersection between a relation and an array works in both directions
Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
2010-09-10 21:13:57 +10:00
Raimonds Simanovskis
af2a011df2 fixed Subject model after_initialize callback for test_oracle_synonym test 2010-09-09 18:27:53 -07:00
Jeremy Kemper
d79b1aa0ba Fewer object allocations 2010-09-09 14:37:58 -07:00
Jeremy Kemper
4b7b8d9e19 Cache unserialized attributes 2010-09-09 14:37:57 -07:00
Emilio Tagua
e3246ef5b5 Add tests for Relation#only. 2010-09-09 15:27:10 -03:00
Aaron Patterson
c6015cbcd8 serialized attributes should be serialized before validation [#5525 state:resolved] 2010-09-07 13:39:27 -07:00
Jakub Suder
2524cf404c fixed some issues with JSON encoding
- as_json in ActiveModel should return a hash
  and handle :only/:except/:methods options
- Array and Hash should call as_json on their elements
- json methods should not modify options argument

[#5374 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-09-07 11:33:10 -07:00
Aaron Patterson
604281221c select should raise error when no block or no parameter is passed 2010-09-07 10:48:14 -07:00
Carlos Antonio da Silva
9b610049bb Cleanup deprecation warnings in active record
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:39:55 +02:00
Nick Ragaz
16e078d908 failing test for reorder overriding default_scope
[5528]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-05 08:27:51 -03:00
Neeraj Singh
91fec0d24d order should always be concatenated.
order that is declared first has highest priority in all cases.

Here are some examples.

Car.order('name desc').find(:first, :order => 'id').name

Car.named_scope_with_order.named_scope_with_another_order

Car.order('id DESC').scoping do
  Car.find(:first, :order => 'id asc')
end

No special treatment to with_scope or scoping.

Also note that if default_scope declares an order then the order
declared in default_scope has the highest priority unless
with_exclusive_scope is used.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-05 08:13:42 -03:00
Piotr Sarnacki
e063879daf Fix copying migrations to empty directory 2010-09-03 22:59:10 +02:00
Piotr Sarnacki
75f8ac6ea7 Implemented ActiveRecord::Migrations#copy based on James Adam's idea
ActiveRecord::Migration#copy allows to copy migrations from one place
to another, changing migrations versions and adding scope to filename.

For example:
ActiveRecord::Migration.copy("db/migrate",
        :blog_engine => "vendor/gems/blog/db/migrate")

will copy all migrations from vendor/gems/blog/db/migrate to db/migrate
with such format:

Versions of copied migrations will be reversioned to be appended after
migrations that already exists in db/migrate
2010-09-03 22:59:09 +02:00
Ken Collins
d28438caf2 A few schema changes for the SQL Server adapter.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-09-03 14:57:16 +12:00
Andrew White
4e67bf26aa Reset default scope in Thread.current when class is unloaded [#5497 state:resolved]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-09-01 22:32:41 +02:00
Emilio Tagua
2ce57fd0d9 Fix test: this should return 0 not 7, since Arel was ignoring select clause and now it's fixed.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 15:09:38 +02:00
Subba Rao Pasupuleti
dba4efbd0e nested attributes tests should rely on associated objects to verify results not on assert_difference [#5206 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-01 09:56:48 +02:00
Pratik Naik
c07f0ae52e Change relation merging to always append select, group and order values 2010-08-31 19:17:18 +01:00
Thiago Pradi
ececa75c66 Fixing typo [#5485 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-28 17:51:22 -03:00
Neeraj Singh
747e0744dd @user.touch should not fail if User does not have updated_at/updated_on column.
[#5439 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-24 11:24:32 -03:00
Wincent Colaiuta
7d71b785a9 Add test case for ActiveRecord::Base.record_timestamps = false
This is a failing test case for Lighthouse ticket #5440:

  https://rails.lighthouseapp.com/projects/8994/tickets/5440

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-24 10:32:45 -03:00
Raimonds Simanovskis
2fc29524e1 use database from ARUNIT_DB_NAME environment variable when running tests on Oracle 2010-08-23 10:50:21 -07:00
Aaron Patterson
cdef4450e5 removing unused code 2010-08-22 17:15:56 -07:00
Raimonds Simanovskis
8f171b4d69 Do not use time zone in test_read_attributes_before_type_cast_on_datetime for Oracle database
As currently string_to_time method is not doing time zone conversion to database time zone
2010-08-22 16:35:55 -07:00
Raimonds Simanovskis
f82b1e756a updated test_should_record_timestamp_for_join_table for Oracle 2010-08-22 16:35:48 -07:00
Brian Lopez
82e389ed30 reload bob after his journy to a new timezone 2010-08-20 20:00:03 -07:00
Aaron Patterson
949c7e2d0e fisting after_rollback and after commit callbacks 2010-08-20 00:06:49 -07:00
Neeraj Singh
2e45542942 While creating a new record using has_many create method default scope of child should be respected.
author.posts.create should take into account default_scope
defined on post.

[#3939: state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-19 14:52:15 -03:00
Aaron Patterson
a4458f5d21 removing useless ternary 2010-08-19 10:46:10 -07:00
Jeremy Kemper
d3e30a18b2 Memoize STI class lookups for the duration of a request 2010-08-19 11:07:09 -05:00
Xavier Noria
5a1d957dce avoids warnings about mismatched indentations in Ruby 1.9.2 2010-08-19 03:44:55 +02:00
Xavier Noria
c510f05967 get rid of the warning "+ after local variable is interpreted as binary operator even though it seems like unary operator" in Ruby 1.9.2 2010-08-19 02:08:28 +02:00
Jeff Lawson
7ce1539934 Bug Fix -- clean up connection after stored procedure [#3151 state:resolved] 2010-08-17 13:15:58 -07:00
Santiago Pastorino
f1b33f7f22 Restore pet -> owner relationship to the previous state
[#5365]
2010-08-16 22:46:55 -03:00