Commit Graph

9631 Commits

Author SHA1 Message Date
Prathamesh Sonpatki
f8a3dda6ce Fxied some typos 2013-05-18 19:23:30 +05:30
Rafael Mendonça França
056acbd0c6 Merge pull request #10676 from tkhr/add-test-to-counter_cache_test.rb
Add test to counter cache test.rb
2013-05-18 05:58:57 -07:00
Takehiro Adachi
2dbb346ffe Fix tests which started to fail due to commit 0123c39f41e2062311b2197e6e230ef8ad67e20e
Due to commit 0123c39f41e2062311b2197e6e230ef8ad67e20e, column
topic.unique_replies_count has been added, and these test started to
fail since the tests depends on the topic tables column info.
2013-05-18 18:22:21 +09:00
Takehiro Adachi
0123c39f41 Add test to AR's counter_cache_test.rb
According to
https://github.com/rails/rails/blob/b601399b72ab56cc01368f02615af99f45d1
4f02/activerecord/lib/active_record/counter_cache.rb#L14, u can pass
more then one association to the `reset_counters` method.
2013-05-18 17:12:46 +09:00
Aaron Patterson
1ff5341385 stop swallowing exceptions in assert_queries. Methods that raise an
exception are unlikely to pass this assertion, but since the assertions
raise an exception, the original exception is lost.
2013-05-17 20:46:41 -07:00
Aaron Patterson
18fe96cc16 stop doing assingments in an iterator 2013-05-17 15:39:39 -07:00
Aaron Patterson
2eecc0d8dc include bind values from the default scope 2013-05-17 14:59:48 -07:00
Aaron Patterson
6062e42f98 let Ruby do the is_a check for us 2013-05-16 16:06:52 -07:00
Aaron Patterson
28574961fb test refactor 2013-05-16 13:33:35 -07:00
Bogdan Gusiev
711097e6a5 Add more data to AR::UnknownAttributeError
begin
  Topic.new("hello" => "world")
rescue ActiveRecord::UnknownAttributeError => e
  e.record # => #<Topic ... >
  e.attribute # => "hello"
end
2013-05-16 13:31:35 -07:00
Aaron Patterson
7816b9852b Merge pull request #10619 from alno/top_level_array_in_postgres_json
Support array as root element in Postgresql JSON columns
2013-05-16 11:38:24 -07:00
Piotr Sarnacki
89f558c8c6 Check if APP_RAKEFILE is defined 2013-05-16 15:52:12 +02:00
Joel Cogen
2583e8ade8 Fix detection of engine in rake db:load_config
Broken by d1d7c86d0c8dcb7e75a87644b330c4e9e7d6c1c1
2013-05-16 12:06:08 +02:00
Aaron Patterson
99860582b2 tiny types should only be integers when the length is <= 1. fixes #10620 2013-05-15 18:03:10 -07:00
phinze
09a16ef178 add failing test exposing mysql adapter tinyint bug
in myself, a column with type TINYINT(N) where N > 1 can be used to
represent an integer, but the rails mysql adapter refuses to interpret
as anything but a boolean.
2013-05-15 17:50:55 -07:00
Aaron Patterson
dcc1267fee require things we need 2013-05-15 10:14:37 -07:00
Rafael Mendonça França
f22dbc62bd Merge pull request #10504 from kennyj/support_pg_91
Also should supports PostgreSQL 9.1 about extensions.
2013-05-15 10:14:04 -07:00
Rafael Mendonça França
5db56659f3 Merge pull request #10601 from Ichimonji10/fix-docs
Rewrite  `activerecord/RUNNING_UNIT_TESTS.rdoc`
2013-05-15 08:30:32 -07:00
Jeremy Audet
87ac19ebbe Rewrite activerecord/RUNNING_UNIT_TESTS
`RUNNING_UNIT_TESTS` is written in an unclear and confusing manner. This commit
attempts to correct that.

Thanks to zzak and vipulnsward for feedback.
2013-05-15 11:07:47 -04:00
kennyj
91c4d0b1e7 Remove unnecessary code, because this extension is created on demand in hstore_test.rb. 2013-05-15 12:47:49 +09:00
kennyj
349fc90996 Also support extensions in PostgreSQL 9.1, because this has been supported since 9.1. 2013-05-15 12:46:54 +09:00
Aaron Patterson
ba55276434 deprecating string based terminators 2013-05-14 16:03:09 -07:00
Alexey Noskov
9b66187622 Support array as root element in JSON 2013-05-14 17:44:32 +04:00
Aaron Patterson
d53b5f0739 Merge branch 'master' into normalizecb
* master: (61 commits)
  add tests for reset_calbacks
  Fixing build broken by this change
  Extract variable out of loop
  Updated comment to Rails 4
  Fixes NoMethodError: `alias_method_chain` when requiring just active_support/core_ext
  better error message when app name is not passed in `rails new`
  Code cleanup for ActionDispatch::Flash#call
  Fix typo: require -> requires
  Add CHANGELOG entry for #10576
  Merge pull request #10556 from Empact/deprecate-schema-statements-distinct
  Some editorial changes on the documentation.
  respond_to -> respond to in a message from AM::Lint
  specify that dom_(id|class) are deprecated in controllers, views are fine
  copy edits [ci skip]
  Fix class and method name typos
  Replace multi_json with json
  ruby -> Ruby
  Adding documentation to the automatic inverse_of finder.
  Improve CHANGELOG entry [ci kip]
  Call assume_migrated_upto_version on connection
  ...

Conflicts:
	activesupport/lib/active_support/callbacks.rb
2013-05-13 11:51:10 -07:00
Rafael Mendonça França
2519fb0e6d Merge pull request #10577 from vipulnsward/fix_method_typos
Fix class and method name typos
2013-05-12 11:29:17 -07:00
Rafael Mendonça França
8d3c67fbc4 Merge pull request #10556 from Empact/deprecate-schema-statements-distinct
Deprecate SchemaStatements#distinct, and make SchemaStatements#columns_for_distinct nodoc.
Conflicts:
	activerecord/CHANGELOG.md
2013-05-12 14:50:28 -03:00
Rafael Mendonça França
33062ee0f1 Some editorial changes on the documentation.
* Remove some autolinks
* Fix the rendered result
* Change sql to SQL

[ci skip]
2013-05-12 14:48:11 -03:00
Vijay Dev
d8b8c0ef87 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	activesupport/lib/active_support/callbacks.rb
2013-05-12 15:57:14 +05:30
Vijay Dev
1a9766f128 copy edits [ci skip] 2013-05-12 15:52:09 +05:30
Vipul A M
7493e0f78a Fix class and method name typos 2013-05-12 15:03:14 +05:30
wangjohn
346cda4f34 Adding documentation to the automatic inverse_of finder. 2013-05-11 23:05:36 -04:00
Rafael Mendonça França
d9e8ec61a4 Improve CHANGELOG entry [ci kip] 2013-05-11 23:51:27 -03:00
Kyle Stevens
443f8dd5cd Call assume_migrated_upto_version on connection
Call assume_migrated_upto_version on connection to prevent it from first
being picked up in method_missing. In the base class, Migration,
method_missing expects the argument to be a table name, and calls
proper_table_name on the arguments before sending to connection. If
table_name_prefix or table_name_suffix is used, the schema version changes
to prefix_version_suffix, breaking `rake test:prepare`.

Fixes #10411.
2013-05-11 22:39:39 -04:00
Rafael Mendonça França
51157c9b46 Merge pull request #10567 from neerajdotname/read_attribute_before_type_cast_should_accept_symbol
read_attribute_before_type_cast should accept symbol
2013-05-11 14:36:06 -07:00
Rafael Mendonça França
0215faf472 Merge pull request #10572 from nertzy/dont-modify-options-hash-in-primary-key
Don't modify args in TableDefinition#primary_key
2013-05-11 16:52:33 -03:00
Neeraj Singh
3e0c06d8ab read_attribute_before_type_cast should accept symbol 2013-05-11 03:12:38 -04:00
Aaron Patterson
23122ab2d4 callbacks are wrapped with lambdas 2013-05-10 10:13:21 -07:00
Ben Woosley
fba18f1994 Extract JoinDependency#join_relation to DRY the repeated application of the #join_associations. 2013-05-10 17:46:04 +02:00
Ben Woosley
35c198ca9b In #apply_join_dependency, we can apply the #where in-place because relation is always a new object.
Thanks to the #except we call at the top of the method.
2013-05-10 17:46:04 +02:00
Ben Woosley
75fe7434a8 DRY-up join dependency creation by extracting construct_join_depdency 2013-05-10 17:46:04 +02:00
Ben Woosley
88219cc88a Pull the excepts into apply_join_dependency, for the sake of DRY. 2013-05-10 17:46:04 +02:00
Ben Woosley
1dcb1ccc9d Simplify conditions within apply_join_dependency 2013-05-10 17:46:04 +02:00
Ben Woosley
cd04a99ba4 Move the except(:select) inside the construct_limited_ids_condition method to pair it closely with its motivation. 2013-05-10 17:46:04 +02:00
Ben Woosley
ec75ff3451 Reject blank order_values within #columns_for_distinct, as the orders aren't used at all on non-postgres adapters. 2013-05-10 17:45:38 +02:00
Jon Leighton
32a5cad1e4 Move #proxy_association method to AssociationRelation 2013-05-10 16:39:27 +02:00
Jon Leighton
1b022990c7 Merge pull request #6792 from Empact/postgres-distinct
Fix that #exists? can produce invalid SQL: "SELECT DISTINCT DISTINCT"
2013-05-10 07:36:11 -07:00
Daniel Schierbeck
1cc63e94db Don't try to EXPLAIN select_db calls 2013-05-10 16:21:59 +02:00
Ben Woosley
15d6e4dce7 Fix that #exists? can produce invalid SQL: "SELECT DISTINCT DISTINCT"
The combination of a :uniq => true association and the #distinct call
in #construct_limited_ids_condition combine to create invalid SQL, because
we're explicitly selecting DISTINCT, and also sending #distinct on to AREL,
via the relation#distinct_value.

Rather than build a select distinct clause in #construct_limited_ids_condition,
I set #distinct! and pass just the columns into the select statement.
This requires introducing a #columns_for_distinct method to return the
select columns but not the statement itself.
2013-05-10 16:13:46 +02:00
Jon Leighton
d7abe91cc7 Set the inverse when association queries are refined
Suppose Man has_many interests, and inverse_of is used.

Man.first.interests.first.man will correctly execute two queries,
avoiding the need for a third query when Interest#man is called. This is
because CollectionAssociation#first calls set_inverse_instance.

However Man.first.interests.where("1=1").first.man will execute three
queries, even though this is obviously a subset of the records in the
association.

This is because calling where("1=1") spawns a new Relation object from
the CollectionProxy object, and the Relation has no knowledge of the
association, so it cannot set the inverse instance.

This commit solves the problem by making relations spawned from
CollectionProxies return a new Relation subclass called
AssociationRelation, which does know about associations. Records loaded
from this class will get the inverse instance set properly.

Fixes #5717.

Live commit from La Conf! 
2013-05-10 10:36:26 +02:00
aditya-kapoor
ff34afc202 Added documentation for ActiveRecord::Generators::MigrationGenerator.next_migration_number 2013-05-10 00:03:29 +05:30