Commit Graph

49941 Commits

Author SHA1 Message Date
Ryuta Kamizono
cddc298dea Add schema dumping tests for datetime and time precision 2015-02-20 10:26:06 +09:00
Ryuta Kamizono
a088ee9691 Format the time string according to the precision of the time column
It is also necessary to format a time column like a datetime column.
2015-02-20 10:25:31 +09:00
Ryuta Kamizono
9ef870c042 Allow :precision option for time type columns 2015-02-20 10:24:08 +09:00
Rafael Mendonça França
9a476b8cd6 Merge pull request #19007 from evanphx/route_proxy
Cache url_helpers instead of creating each time
2015-02-19 21:34:51 -02:00
Evan Phoenix
e002a68a4e Make the helpers a required argument 2015-02-19 15:11:08 -08:00
Evan Phoenix
43dae99645 Cache url_helpers instead of creating each time
This has 2 effects:

1. RoutesProxy is CRAZY faster because it's no longer creating a new
Module each time method_missing is hit.
2. It bypasses an existing bug in ruby that makes `class << obj` unsafe
to be used in threading contexts.
2015-02-19 14:20:56 -08:00
Rafael Mendonça França
da2987afc9 Merge pull request #19005 from meganemura/remove-last-empty-line-in-gemfile
Remove last empty line when we don't use Windows or JRuby
2015-02-19 15:43:13 -02:00
meganemura
740c0f058d Remove last empty line when we don't use Windows or JRuby 2015-02-20 02:39:42 +09:00
Abdelkader Boudih
108fcbc6da Merge pull request #19004 from danieldevries/fix-migration-fieldname-in-example
fix column name in migration example [ci skip]
2015-02-19 15:08:49 +00:00
Daniël de Vries
5d463bd029 fix column name in migration example [ci skip] 2015-02-19 16:03:22 +01:00
Abdelkader Boudih
0b09261af5 Merge pull request #19002 from bdewater/patch-1
Fix code sample for custom exception handler to match text [ci skip]
2015-02-19 14:23:02 +00:00
Bart
c2f59f37c6 Fix code sample for custom exception handler [ci skip] 2015-02-19 15:22:27 +01:00
Yves Senn
259d33db8c Merge pull request #18996 from morgoth/deprecate-more-errors-methods
Deprecate `ActiveModel::Errors` `add_on_empty` and `add_on_blank` methods
2015-02-19 14:16:47 +01:00
Wojciech Wnętrzak
fd38838f29 Deprecate ActiveModel::Errors add_on_empty and add_on_blank methods
without replacement.
2015-02-19 14:10:38 +01:00
Rafael Mendonça França
ad5834f20f Merge pull request #18916 from kamipo/handle_array_option_in_type_to_sql
Handle array option in `type_to_sql`
2015-02-19 09:49:18 -02:00
Rafael Mendonça França
b8101afcb8 Merge pull request #18979 from kamipo/extract_precision_from_datetime_and_time_columns
Extract precision from datetime and time columns
2015-02-19 09:47:32 -02:00
Rafael Mendonça França
6ad28a795b Do not mutate the operations array 2015-02-19 09:29:09 -02:00
Rafael Mendonça França
4f56a1df54 Return true instead of self when suppressed
save is documented to return singletons so we should always return a
singleton.
2015-02-19 09:25:20 -02:00
Rafael Mendonça França
e28721baf2 Copy edit the suppressor documentation
[ci skip]
2015-02-19 09:08:51 -02:00
Rafael Mendonça França
41b9730c6d Merge pull request #18910 from perceptec/add_suppressor
Add `ActiveRecord::Base.suppress` to allow save events to be suppressed within a specified block.
2015-02-19 09:04:31 -02:00
Ryuta Kamizono
4b38a99e7a Extract precision from datetime and time columns
The cause by which the test suite for the mysql adapter broke in 1502cae
(reverted 89ba5bb) is because the precision was not extracted.

The rounding problem in mysql adapter has not been fixed, but `mysql_56`
helper tested only mysql2 adapter, its behavior was not apparent.
2015-02-19 16:00:16 +09:00
Guillermo Iguaran
06d5d2c5e9 Merge pull request #18994 from tgxworld/run_delete_middleware_operations_last
Allow Rack::Runtime to be deleted from middleware stack.
2015-02-19 00:18:05 -05:00
Guillermo Iguaran
22a347d44a Merge pull request #18999 from simi/remove-unused-gsub_app_file
Remove unused gsub_app_file method from Bukkit.
2015-02-18 23:41:56 -05:00
Ryuta Kamizono
9ec2d4a39b Handle array option in type_to_sql
`[]` is a part of `sql_type`, so it is always necessary to respect to
array option when `type_to_sql` is called.
2015-02-19 11:24:01 +09:00
Ryuta Kamizono
7ba2cd06a2 Use delegate to call the methods to @conn 2015-02-19 11:24:01 +09:00
Ryuta Kamizono
949b133626 Should handle array option for :cast_as 2015-02-19 11:24:01 +09:00
Josef Šimánek
6447309817 Remove unused gsub_app_file method from Bukkit. 2015-02-19 02:44:49 +01:00
Guo Xiang Tan
a39498ae06 Allow Rack::Runtime to be deleted from middleware stack.
Fixes: https://github.com/rails/rails/issues/16433.
2015-02-19 08:44:24 +08:00
eileencodes
95ee93892a Freeze strings to reduce allocations in integration tests
Moves `X-Request-ID`, `action_dispatch.request_id` and
`HTTP_X_REQUEST_ID` strings to constants and freezes them.

We are freezing these strings to reduce the number of allocations in
Rails integration tests. The tests are spending a lot of time in GC and
this reduces the amount of time spent from 12% to 9% (in combination
with Rack PR that also freezes some strings).

Number of allocations before this change: 1030722
Number of allocations after this change: 967722
2015-02-18 18:54:37 -05:00
eileencodes
e334417b78 Reduce the number of times #clean_path_info is called
It's unnecessary to call `#clean_path_info`. It doesn't need to be
called on the path with each extension. This reduces allocations to
`Rack::Utils` in integration tests.

Before `#clean_path_info` from `Rack::Utils` (line 622) was number 2
in top 5 allocations:
```
[["rack/lib/rack/utils.rb", 499, :T_STRING], [51034, 4539, 71559, 0, 12, 1791120]]
[["rack/lib/rack/utils.rb", 662, :T_STRING], [33012, 0, 27930, 0, 1, 1226009]]
[["rails/activesupport/lib/active_support/notifications/fanout.rb", 55, :T_DATA], [29998, 0, 25380, 0, 1, 3230600]]
[["rails/activesupport/lib/active_support/subscriber.rb", 99, :T_STRING], [29996, 0, 25378, 0, 2, 1113840]]
[["rails/activesupport/lib/active_support/notifications/instrumenter.rb", 52, :T_HASH], [29994, 147, 27014, 0, 11, 4897784]]
```

After `#clean_path_info` from `Rack::Utils` (line 622) does not appear
in the top 5 highest allocations:
```
[["rack/lib/rack/utils.rb", 499, :T_STRING], [47617, 2414, 68969, 0, 12, 1667360]]
[["rack/lib/rack/body_proxy.rb", 34, :T_ARRAY], [28230, 0, 26060, 0, 1, 1046800]]
[["rails/activesupport/lib/active_support/notifications/fanout.rb", 55, :T_DATA], [28208, 0, 26042, 0, 1, 3034096]]
[["rails/activesupport/lib/active_support/subscriber.rb", 99, :T_STRING], [28204, 0, 26040, 0, 1, 1046080]]
[["rails/activesupport/lib/active_support/callbacks.rb", 165, :T_DATA], [28200, 0, 26046, 0, 2, 3451800]]
```
2015-02-18 18:54:26 -05:00
Michael Ryan
b9a1e9a4b2 Add ActiveRecord::Base.suppress 2015-02-18 18:30:05 -05:00
Eileen M. Uchitelle
83be86933d Merge pull request #18956 from hjoo/time_option
Add `time` option to `#touch
2015-02-18 17:54:18 -05:00
Rafael Mendonça França
d0303d03a9 Try only to decode strings
This approach will avoid us to check for NoMethodError when trying to
decode
2015-02-18 19:37:56 -02:00
Rafael Mendonça França
fb876b8a2c Merge pull request #18917 from lautis/non-string-csrf-token
Handle non-string authenticity tokens
2015-02-18 19:37:24 -02:00
Rafael Mendonça França
4ffe46f5fe Merge pull request #18411 from todd/extract_record_tag_helper
Remove RecordTagHelper
2015-02-18 19:19:48 -02:00
Rafael Mendonça França
39c936b760 Merge pull request #18393 from y-yagi/fix_mailer
follow up to #18074
2015-02-18 19:05:07 -02:00
Rafael Mendonça França
3c750c4c6c Merge pull request #18634 from morgoth/deprecate-some-errors-methods
Deprecate `ActiveModel::Errors` `get`, `set` and `[]=` methods.
2015-02-18 18:58:28 -02:00
Rafael Mendonça França
c407693a41 Add nodoc to private constant [ci skip] 2015-02-18 17:44:57 -02:00
Rafael Mendonça França
3bd7c29ace Merge pull request #18970 from nithinbekal/local-assigns-doc
Add documentation for local_assigns [ci skip]
2015-02-18 17:42:03 -02:00
Rafael Mendonça França
02b955766e Improve documentation of local_assigns 2015-02-18 17:40:58 -02:00
Rafael Mendonça França
e07eb079bf Merge pull request #15700 from maurogeorge/guides-local_assigns
Add docs about local_assigns on guides
2015-02-18 17:34:37 -02:00
Rafael Mendonça França
ef4afb65b2 Talk about Gemfile.lock in the contributing guide
[ci skip]
2015-02-18 16:37:43 -02:00
Rafael Mendonça França
a845abdb85 Merge pull request #18992 from rails/rm-track-lock-file
Track Gemfile.lock at the repository
2015-02-18 15:52:41 -02:00
Rafael Mendonça França
0ad6d27643 Revert "Merge pull request #18951 from jurezove/gemfile-lock-to-plugin-gitignore-template"
This reverts commit b824dfd44bf2dd932d6d955ac868af1020f0099a, reversing
changes made to 265dcb779dd4bfd9745e0131f585749d7034c3c7.

Our general recommendation is to check in the lock file in the
repository.

This make possible to developers and contributors of a plugin always run
their tests against a working set of dependencies.

Also, bisect is a lot easier, specially if you have git dependencies in your
Gemfile.
2015-02-18 15:20:25 -02:00
Rafael Mendonça França
b1edc3789a Track Gemfile.lock at the repository
The main reason is to make bisect easier.

In some points, we have a lot of git dependencies. Since we don't have
the information of which commit we are referring to, bundler get the
latest commit of the master branch of the dependency. This sometimes
returns a version that is not compatible with Rails anymore, making the
tests fail and the harder to identify the commit that introduced a bug.

Also this will make sure that a contributor will always get a set of
dependencies that are passing with our tests.

In our CI server we delete the lock file to make sure we are always
testing against the newest release of our dependencies.
2015-02-18 15:14:46 -02:00
Hyonjee Joo
219d71fb90 Add time option to #touch
Fixes #18905. `#touch` now takes time as an option. Setting the option
saves the record with the updated_at/on attributes set to the current time
or the time specified. Updated tests and documentation accordingly.
2015-02-18 10:22:13 -05:00
Carlos Antonio da Silva
28fccad2c4 Merge pull request #18984 from rousisk/master
Replace deprecated readonly option with scope blocks in docs and guide
2015-02-18 10:47:32 -02:00
Carlos Antonio da Silva
b5ce18608e Merge pull request #18987 from kamipo/prefer_drop_table_if_exists_true_over_raw_sql
Prefer `drop_table if_exists: true` over raw SQL
2015-02-18 10:45:12 -02:00
Ryuta Kamizono
af64c82411 Prefer drop_table if_exists: true over raw SQL
Lowercase raw SQL has been replaced by 07b659c already. This commit
replaces everything else of raw SQL.
2015-02-18 20:58:45 +09:00
Xavier Noria
9814eb6427 constants guide: adds a step to a resolution algorithm
Not sure how this one slipped, maybe deleted by accident while editing or
something. Anyway, fixed.
2015-02-18 12:37:19 +01:00