Commit Graph

53383 Commits

Author SHA1 Message Date
Ronak Jangir
d1a35c35d5 Removed Mocha from app generators tests 2015-09-23 23:36:25 +05:30
Sean Griffin
f860ab3f14 Further remove reliance on subsecond precision in tests 2015-09-23 09:43:19 -06:00
Sean Griffin
05436172db Don't rely on subsecond precision being applied in tests
When I originally reviewed the #20317, I believe these changes were
present, but it appears that it was later updated so that they were
removed. Since Travis hadn't re-run the build, this slipped through.
2015-09-23 09:33:43 -06:00
Sean Griffin
2c7d0d42ac 0 precision is not the same as no precision
And we are passing them as separate types in the query, which means 0
precision is still not supported by older versions of MySQL. I also
missed a handful of other cases where they need to be conditionally
applied.
2015-09-23 09:15:59 -06:00
Sean Griffin
f696494aed Don't attempt to specify datetime precision unless supported
Specifically, versions of MySQL prior to 5.6 do not support this, which
is what's used on Travis by default. The method `mysql_56?` appeared to
only ever be used to conditionally apply subsecond precision, so I've
generalized it and used it more liberally.

This should fix the test failures caused by #20317
2015-09-23 09:09:50 -06:00
Sean Griffin
66337b62ad Merge pull request #20317
AR: take precision into count when assigning a value to timestamp
attribute
2015-09-23 09:01:38 -06:00
Bogdan Gusiev
d03f519665 Fixed taking precision into count when assigning a value to timestamp attribute
Timestamp column can have less precision than ruby timestamp
In result in how big a fraction of a second can be stored in the
database.

  m = Model.create!
  m.created_at.usec == m.reload.created_at.usec
    # => false
    # due to different seconds precision in Time.now and database column

If the precision is low enough, (mysql default is 0, so it is always low
enough by default) the value changes when model is reloaded from the
database. This patch fixes that issue ensuring that any timestamp
assigned as an attribute is converted to column precision under the
attribute.
2015-09-23 13:29:08 +03:00
Abdelkader Boudih
f5fe01e836 Merge pull request #21732 from amitsuroliya/mime_docs
Updated Mime Negotiations docs [ci skip]
2015-09-23 11:26:55 +02:00
amitkumarsuroliya
96eece6cb4 Updated Mime Negotiations docs [ci skip]
As we all know that Accessing mime types via constants is deprecated. Now, we are using `Mime::Type[:JSON]` instead of `Mime::JSON`
2015-09-23 14:52:27 +05:30
Kasper Timm Hansen
1e9593a37c Merge pull request #21729 from y-yagi/fix_warning_in_ar
remove warning from Calculations#sum
2015-09-23 09:07:20 +02:00
yuuji.yaginuma
908d68718d remove warning from Calculations#sum
This removes the following warning.
```
activerecord/lib/active_record/relation/calculations.rb:74: warning: `&' interpreted as argument prefix
```
2015-09-23 15:19:56 +09:00
Andrew White
ef7791ca14 Merge pull request #21723 from y-yagi/fix_deprecate_msg_in_mailers_controller
stop using deprecated method in mailers controller
2015-09-23 05:31:43 +01:00
Rafael Mendonça França
7c08e1ac6d Merge pull request #21725 from yui-knk/fix/ar_sum
Fix arguments of `AR::Calculations#sum`
2015-09-23 01:18:42 -03:00
Sean Griffin
624253f1d1 Merge pull request #21728 from cllns/fix-engine-path
Remove leading slash from path
2015-09-22 22:14:44 -06:00
Sean Griffin
4a7c82d206 Merge pull request #21727 from yui-knk/fix/remove_unused_args
Remove not used argument `table_name` of `sanitize_sql_for_conditions`
2015-09-22 22:13:24 -06:00
Sean Collins
1b9e2bc5aa Remove leading slash from path
The leading slash denotes an absolute path,
rather than a relative one (which is more popular)

[ci skip]
2015-09-22 22:05:06 -06:00
yui-knk
f37db17345 Remove not used argument table_name of sanitize_sql_for_conditions
This argument was needen when `sanitize_sql_for_conditions` internally
called `sanitize_sql_hash_for_conditions`.
But `sanitize_sql_hash_for_conditions` was deprecated
(eb921000a1)
and deleted
(3a59dd2123)
(4bd089f1d9).
2015-09-23 11:37:37 +09:00
Sean Griffin
eb52c8979b Merge pull request #21726 from yui-knk/test/named_bind_arity
Add tests for sanitize named bind arity
2015-09-22 20:21:55 -06:00
yui-knk
199d4e28e0 Add tests for sanitize named bind arity 2015-09-23 10:57:25 +09:00
yuuji.yaginuma
43ee2d8ce5 stop using deprecated method in mailers controller
Accessing mime types via constants is deprecated.
2015-09-23 10:13:52 +09:00
yui-knk
0f6d47d88f Fix arguments of AR::Calculations#sum
Arguments of `#sum` does not match with other shortcuts methods
(count, average, minimum, and maximum).
This commit fix these two points:

* call `super` with only block arguments
  First argument of `super` method, `Enumerable#sum`, is `identity`
  and first argument of `AR::Calculations#sum` is `column_name`.
  `Enumerable#sum` does not expect `column_name` to be passed.
* Change first argument of `sum` from array arguemnt to single
  argument to match other shortcuts methods. When `sum` accept
  array arguemnt, user can pass multi arguments and an exception is
  raised from `calculate`.
2015-09-23 10:08:46 +09:00
Aaron Patterson
9f23ee0fdc ask the request object for the session
The flash middleware shouldn't know how to look up the session object.
Just ask the request for that information.
2015-09-22 17:43:15 -07:00
Aaron Patterson
a9f28600e9 don't deal with nil values
We can know whether or not there is a content type object, and just exit
early.  There is no need to `try` so hard.
2015-09-22 16:20:27 -07:00
Yves Senn
686897225e Merge pull request #21722 from ronakjangir47/test_delivery_methods
Added assertion for error messages for nil and unknown delivery methods
2015-09-22 23:22:58 +02:00
Yves Senn
7805fa2b0b Merge pull request #21715 from rails/introduce_data_sources
introduce `conn.data_source_exists?` and `conn.data_sources`.
2015-09-22 22:29:59 +02:00
Yves Senn
152b85f06c introduce conn.data_source_exists? and conn.data_sources.
These new methods are used from the Active Record model layer to
determine which relations are viable to back a model. These new methods
allow us to change `conn.tables` in the future to only return tables and
no views. Same for `conn.table_exists?`.

The goal is to provide the following introspection methods on the
connection:

* `tables`
* `table_exists?`
* `views`
* `view_exists?`
* `data_sources` (views + tables)
* `data_source_exists?` (views + tables)
2015-09-22 19:48:44 +02:00
Rafael Mendonça França
3bbc325613 Merge pull request #21718 from thiagoaugusto/patch-4
Update i18n.md [ci skip]
2015-09-22 13:40:54 -03:00
Thiago Augusto
c4c70322c4 Update i18n.md [ci skip] 2015-09-22 13:22:53 -03:00
Kasper Timm Hansen
4aefd95945 Remove unneeded generator variable. 2015-09-22 18:07:00 +02:00
Kasper Timm Hansen
931c0861b4 Merge pull request #21356 from ronakjangir47/remove_mocha_railties
Removed mocha from Railites PluginGeneratorTest
2015-09-22 18:01:27 +02:00
Yves Senn
5e4df5c674 tests, use if_exists: true instead of rescue nil. 2015-09-22 17:28:54 +02:00
Akira Matsuda
d30f934af0 AMo typos 2015-09-22 23:36:40 +09:00
Ronak Jangir
352690e166 Removed mocha from Railites PluginGeneratorTest 2015-09-22 19:27:42 +05:30
Ronak Jangir
ecc9473622 Added assertion for error messages for nil and unknown delivery methods
As `deliver_now` `RuntimeError` for both nil & unknown delivery method so it’s good to have assertion for error messages
2015-09-22 19:11:03 +05:30
Richard Schneeman
6073dcd3f2 Merge pull request #21714 from thiagoaugusto/patch-2
Update routing.md
2015-09-22 08:29:34 -05:00
Thiago Augusto
89c53ece47 Update routing.md 2015-09-22 10:17:43 -03:00
Yves Senn
1165e9c898 fix bin/test -a sqlite3_mem.
We should not run MysqlAdapter tests when running with `sqlite3_mem`.
This also moves the test-case outside the MysqlAdapter namespace. This
will prevent the following error when running everything:

```
  1) Error:
TestAdapterWithInvalidConnection#test_inspect_on_Model_class_does_not_raise:
TypeError: superclass mismatch for class MysqlAdapter
```
2015-09-22 13:13:27 +02:00
Yves Senn
3931cec9cd Merge pull request #20569 from theSteveMitchell/master
Check mysql structure_load for errors
2015-09-22 11:10:58 +02:00
Yves Senn
8842ce2395 Merge pull request #21712 from amitsuroliya/html_fix
Correcting output of `file_field` with `multiple` attribute option [ci skip]
2015-09-22 10:35:47 +02:00
amitkumarsuroliya
851760c0e1 Correcting output of file_field with multiple attribute option [ci skip] 2015-09-22 14:02:24 +05:30
Yves Senn
d1a43d32e6 Merge pull request #21678 from ronakjangir47/array_to_formatted_s_docs
Added Examples in docs for internal behavior of Array#to_formatted_s [ci skip]
2015-09-22 10:25:14 +02:00
Claudio B.
2a7e8f54c6 Merge pull request #21710 from amitsuroliya/correct_result
Correcting output of `number_to_percentage` example in `number_helper…
2015-09-21 23:43:40 -07:00
Robin Dupret
a29e8a4593 Merge pull request #21711 from JuanitoFatas/doc/typo-1
Fix a typo: Mime::Types should be Mime::Type [ci skip]
2015-09-22 08:30:37 +02:00
amitkumarsuroliya
f077cc6f41 Correcting output of number_to_percentage example in number_helper [ci skip]
Here is correct output of `number_to_percentage(100, format: "%n  %”)`
2015-09-22 07:38:02 +05:30
Juanito Fatas
2510784e78 Fix a typo: Mime::Types should be Mime::Type [ci skip] 2015-09-22 10:04:27 +08:00
Jeremy Daer
b694796da0 Merge pull request #21703 from ronakjangir47/redirect_error_messages
Added assertion for error messages for redirection to nil and params
2015-09-21 17:44:19 -07:00
Aaron Patterson
6486c7ac94 drop array allocations on Mime::Type#=~
Synonyms are always a list of strings, and we have access to the
internal string representation, so we can avoid allocating new arrays.
2015-09-21 15:30:02 -07:00
Aaron Patterson
e35225e938 remove another blank? call 2015-09-21 15:06:52 -07:00
Aaron Patterson
1fe0a1b5eb remove html_types set
Now that `all` has it's own object, we don't need the html_types Set.
2015-09-21 15:05:00 -07:00
Aaron Patterson
d74c8e53b8 compare arrays not set objects. 2015-09-21 14:55:34 -07:00