Commit Graph

38851 Commits

Author SHA1 Message Date
kennyj
098c9c8bc9 Fix indentation. 2013-07-24 23:26:33 +09:00
kennyj
19291bff34 Simplify select_one method.
The select_all method always returns ActiveRecord::Result instance,
and the ActiveRecord::Result includes Enumerable mixin.
If #empty?, #first method returns nil. Thus we can simplify this method.
2013-07-24 23:24:22 +09:00
Carlos Antonio da Silva
3a4d0b1e29 Refactor to use flat_map 2013-07-23 21:13:22 -03:00
Aaron Patterson
ee7516436e oops! 2013-07-23 17:08:04 -07:00
Aaron Patterson
67978d6245 eliminate conditional in JoinHelper 2013-07-23 17:02:14 -07:00
Aaron Patterson
b8aebb0261 acually get the actual source reflection 😢🔫 2013-07-23 17:02:14 -07:00
Guillermo Iguaran
2aa20b3638 Merge pull request #11107 from nettsundere/password-confirmation-fix
Fix secure_password password_confirmation validations
2013-07-23 16:56:36 -07:00
Vladimir Kiselev
3be0cdfa55 Fix secure_password password_confirmation validations 2013-07-24 03:14:15 +04:00
Aaron Patterson
844efb2bb0 stop relying on side effects of const_missing 2013-07-23 15:02:43 -07:00
Aaron Patterson
f38b544442 add a specific factory method rather than using new 2013-07-23 14:43:32 -07:00
Zachary Scott
b017562382 Use GeneratedAttribute#column_name if #reference? scaffold_generator in _form view [Fixes #11573] 2013-07-23 18:06:44 -03:00
Aaron Patterson
eb8d48eb3e factory methods should not have side effects.
Move model mutation to the methods that are called on the model.
2013-07-23 13:12:25 -07:00
Aaron Patterson
5f169b2aed extract mutation from generation method 2013-07-23 13:06:57 -07:00
Rafael Mendonça França
f8ea7c8b00 Merge pull request #11566 from rajcybage/master
add the missing middleware in command line guides rake about [ci skip]
2013-07-23 05:32:04 -07:00
Aaron Patterson
e69d804b5e habtm can only ever be an association reflection 2013-07-22 22:27:25 -07:00
Rajarshi Das
8690b1a895 add the missing middleware in command line guides rake about [ci skip] 2013-07-23 10:19:44 +05:30
Aaron Patterson
6e24d501d3 use the predicate method 2013-07-22 18:46:56 -07:00
Carlos Antonio da Silva
fe820a772d Stop reading the same file twice for testing different content
assert_file already gives this functionality for free by passing
multiple contents.
2013-07-22 22:43:38 -03:00
Aaron Patterson
d531ac0b9a AR::Base does not need to know how to create reflection objects 2013-07-22 18:28:54 -07:00
Aaron Patterson
e20dd73df4 remove unnecessary reader 2013-07-22 18:14:48 -07:00
Aaron Patterson
0aa6872dc5 only flatten one side 2013-07-22 18:12:01 -07:00
Aaron Patterson
7085aae901 extend by adding relationships rather than monkey patching 2013-07-22 18:11:36 -07:00
Aaron Patterson
bb1492e334 decouple extensions from association object state 2013-07-22 17:59:42 -07:00
Guillermo Iguaran
1ccc132832 Merge pull request #11558 from kennyj/bump_mysql2_to_0_3_13
Uses mysql2 0.3.13 or later.
2013-07-22 15:03:28 -07:00
kennyj
71d29251a5 Uses mysql2 0.3.13 or later 2013-07-23 02:50:24 +09:00
Carlos Antonio da Silva
1c4eb13345 Leave the knowledge of boolean tag values to content tag
content tag already knows which tags are boolean and the values that
should generate them when a truthy value is passed, so leave this logic
for it instead of duplicating when generating options tags.
2013-07-22 14:39:45 -03:00
Carlos Antonio da Silva
b973852feb Use merge! to avoid a new hash and change some spots to 1.9 hash style 2013-07-22 14:36:10 -03:00
Carlos Antonio da Silva
c23c193a84 Fix changelog syntax and use Ruby 1.9 hash style [ci skip] 2013-07-22 14:36:09 -03:00
Yves Senn
2d50bc205d Merge pull request #11461 from kennyj/fix_11454
Fixes #11454 . We should define the return type of select_all method clearly.
2013-07-22 10:26:18 -07:00
kennyj
dc1239d965 Added some usage about ActiveRecord::Result [ci skip] 2013-07-23 02:20:28 +09:00
kennyj
42f4ec6265 Defines the return type of select / select_all method. 2013-07-23 02:05:49 +09:00
Carlos Antonio da Silva
68bbbd470d Move #11546 changelog to the top [ci skip] 2013-07-22 12:51:36 -03:00
Piotr Sarnacki
4e211d3fac Add info about placing a new CHANGELOG entry to contributing guide 2013-07-22 17:25:22 +02:00
Piotr Sarnacki
73bbf54868 Revert "Match Dev/Prod parity for Index Page"
Showing welcome page in production can expose information, which should
not be visible on production if people don't override the default root
route.

This reverts commit b0caea29c2da9f4c8bb958019813482da297067d.
2013-07-22 17:19:07 +02:00
Piotr Sarnacki
782d2f6f83 Merge pull request #11546 from swoop-inc/ss_memory_store_cache_size
[Fixes #11512] improves cache size calculation in MemoryStore
2013-07-22 08:05:07 -07:00
Simeon Simeonov
51d9b9a821 [Fixes #11512] improves cache size calculation in ActiveSupport::Cache::MemoryStore
Previously, the cache size of `ActiveSupport::Cache::MemoryStore` was calculated
as the sum of the size of its entries, ignoring the size of keys and any data
structure overhead. This could lead to the calculated cache size sometimes being
10-100x smaller than the memory used, e.g., in the case of small values.

The size of a key/entry pair is now calculated via `#cached_size`:

    def cached_size(key, entry)
      key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
    end

The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
1.9.3 and 2.0.

Fixes GH#11512 https://github.com/rails/rails/issues/11512
2013-07-22 09:53:03 -04:00
Rafael Mendonça França
ecd70039ba Merge pull request #11528 from Empact/optimistic_lock_improvement
Rebase and make fixes to #6763 "Specified column type for quote_value"
2013-07-22 06:03:41 -07:00
Rafael Mendonça França
49c8b671ec Merge pull request #11537 from Karunakar/small_fix
syntax fix f.select doc
2013-07-22 05:53:24 -07:00
Karunakar (Ruby)
afa5445060 syntax fix for f.select doc. [ci skip] . 2013-07-22 18:04:50 +05:30
Yves Senn
b904701ff6 Merge pull request #11551 from skammer/patch-1
Removed random dot in ActionController docs [ci skip]
2013-07-22 05:14:30 -07:00
Max Vasiliev
0d477e40a8 Removed random dot in code sample [ci skip] 2013-07-22 16:13:18 +04:00
Santiago Pastorino
891a573c75 Merge pull request #11549 from dmathieu/test_duplication
Remove duplication in include test
2013-07-22 05:09:47 -07:00
Santiago Pastorino
e89d4d3a17 Merge pull request #11536 from dpickett/patch-1
metal is no longer mentioned on rack guide
2013-07-22 05:02:25 -07:00
Ben Woosley
31a43ebc10 Don't allow quote_value to be called without a column
Some adapters require column information to do their job properly.
By enforcing the provision of the column for this internal method
we ensure that those using adapters that require column information
will always get the proper behavior.
2013-07-22 04:49:18 -07:00
Ben Woosley
c083dc22dd Tidy up the "Specified column type for quote_value" changes
This includes fixing typos in changelog, removing a deprecated
mocha/setup test require, and preferring the `column_for_attribute`
accessor over direct access to the columns_hash in the new code.
2013-07-22 04:39:38 -07:00
Alfred Wong
39b5bfe239 Specified column type for quote_value
When calling quote_value the underlying connection sometimes requires
more information about the column to properly return the correct quoted
value.

I ran into this issue when using optimistic locking in JRuby and the
activerecord-jdbcmssql-adapter. In SQLSever 2000, we aren't allowed to
insert a integer into a NVARCHAR column type so we need to format it as
N'3' if we want to insert into the NVARCHAR type. Unfortuantely, without
the column type being passed the connection adapter cannot properly return
the correct quote value because it doesn't know to return N'3' or '3'.

This patch is fairly straight forward where it just passes in the column
type into the quote_value, as it already has the ability to take in the column,
so it can properly handle at the connection level.

I've added the tests required to make sure that the quote_value method
is being passed the column type so that the underlying connection can
determine how to quote the value.
2013-07-22 04:39:35 -07:00
Piotr Sarnacki
bf2161d1ab Merge pull request #11538 from vipulnsward/rescue-exp
rescue from all exceptions in `ConnectionManagement#call`
2013-07-22 03:27:57 -07:00
Piotr Sarnacki
230d2f84a1 Merge pull request #11514 from schneems/schneems/dev-prod-parity-index
Match Dev/Prod parity for Index Page
2013-07-22 03:25:27 -07:00
Vipul A M
0b6c1f082f rescue from all exceptions in ConnectionManagement#call
Fixes #11497

As `ActiveRecord::ConnectionAdapters::ConnectionManagement` middleware does not rescue from Exception (but only from StandardError),
the Connection Pool quickly runs out of connections when multiple erroneous Requests come in right after each other.

Recueing from all exceptions and not just StandardError, fixes this behaviour.
2013-07-22 14:44:33 +05:30
Damien Mathieu
7aae4e5e66 remove useless duplication in include test 2013-07-22 10:31:14 +02:00