Commit Graph

56319 Commits

Author SHA1 Message Date
Jon Moss
96355e87cb Merge pull request #23366 from maclover7/add-configuation-ar-docs
Add configuration section to "Active Record Basics" guide
2016-01-30 19:47:22 -05:00
Jon Moss
3ded07e7c8 Add configuration section to "Active Record Basics" guide
This is to fill in some missing information as apart of #22931.

It's on purpose that the sample `Message` model inherits from
`ActiveRecord::Base` -- Active Record is not meant to be coupled to
Rails, and we can't guarantee that users outside of the Rails world will
have an `ApplicationRecord` class that inherits from
`ActiveRecord::Base`.

[ci skip]
2016-01-30 19:46:00 -05:00
Jon Moss
a00c36feea Merge pull request #23364 from maclover7/fix-23358
Small cleanup to Testing Guide
2016-01-30 15:11:36 -05:00
Jon Moss
d2bd7bba8e Small cleanup to Testing Guide
- inbuilt --> built-in
- Remove random spaces from code examples

[ci skip]
2016-01-30 15:10:25 -05:00
Vipul A M
153438f749 Merge pull request #23358 from vipulnsward/testing-guide-pass-3
Pass 3 over testing guide
2016-01-31 01:30:09 +05:30
Vipul A M
c01948cc57 Pass 3 over testing guide
- Various grammar fixes
- Added assertions for update controller action tests
- Added user helper tests
- Fix typos

[ci skip]
2016-01-31 01:28:50 +05:30
Vipul A M
b212bef139 Merge pull request #23363 from pra85/patch-1
typo fix [ci skip]
2016-01-31 01:00:59 +05:30
Prayag Verma
4663cab624 typo fix [ci skip]
Spelling mistake - direcotry > directory
2016-01-31 00:59:14 +05:30
Jon Moss
2e465e138b Merge pull request #23362 from vipulnsward/20821-save-doc-update
- Updated persistence documentation to make it clear that save and sa…
2016-01-30 14:20:17 -05:00
Vipul A M
6c54f6c746 - Updated persistence documentation to make it clear that save and save! won't update a record if validation fails.
- Also fixed `update` method's documention to be uniform about this statement.
Fixes #20821

[ci skip]

[Vipul A M & pseidemann ]
2016-01-31 00:36:23 +05:30
Ryuta Kamizono
bee8bb5801 OID::Money.precision is unused since #15239
p PostgreSQLAdapter::OID::Money.precision
    # => 19

    p PostgreSQLAdapter::OID::Money.new.precision
    # => nil
2016-01-31 03:59:30 +09:00
Ryuta Kamizono
ff16a39922 Make to primary key instead of an unique index for internal tables 2016-01-31 03:26:57 +09:00
Rafael Mendonça França
a398cd0bcb Revert "Merge pull request #23346 from kamipo/refactor_oid_money_precision"
This reverts commit ff835f90800a3e4122d64606cb328908c2e0e071, reversing
changes made to c4d85dfbc71043e2a746acd310e32f4f04db801a.

Reason: This broke the tests. We will add back after investigated.
2016-01-30 12:42:39 -05:00
Rafael França
a59212709c Merge pull request #23345 from yui-knk/warning_when_composite_primary_key_is_detected
Warn if `AR.primary_key` is called for a table who has composite prim…
2016-01-30 12:21:52 -05:00
Rafael França
33848384f3 Merge pull request #23349 from kamipo/refactor_column_exists
Refactor `column_exists?` in `SchemaStatements`
2016-01-30 12:20:02 -05:00
Rafael França
b789f6dff4 Merge pull request #23355 from kamipo/fix_bigint_for_enum_columns
Fix `bigint?` for Enum columns in MySQL
2016-01-30 12:19:00 -05:00
Rafael França
7d18de3bb5 Merge pull request #23350 from kamipo/refactor_schema_migration_drop_table
Make `SchemaMigration.drop_table` to one SQL
2016-01-30 12:15:32 -05:00
Rafael França
92dcda5ca3 Merge pull request #23352 from yui-knk/move_test_conditions
There is no need to define test if a connection does not support prim…
2016-01-30 12:14:39 -05:00
Rafael França
2cf1284381 Merge pull request #23353 from kamipo/remove_unused_lost_connection_error_messages
Remove unused `LOST_CONNECTION_ERROR_MESSAGES`
2016-01-30 12:13:26 -05:00
Rafael França
4187699087 Merge pull request #23347 from yui-knk/explicitly_define_columns_as_interface
Explicitly define `columns` method as an interface
2016-01-30 12:12:23 -05:00
Rafael França
8d30ef7cdd Merge pull request #23342 from y-yagi/remove_unused_variable
remove unused variable from render test
2016-01-30 12:11:02 -05:00
Rafael França
dfde688496 Merge pull request #23343 from y-yagi/remove_unused_require
remove unused require
2016-01-30 12:10:47 -05:00
Rafael Mendonça França
bb6f36ee39 Allow failures for Action Cable tests 2016-01-30 12:08:21 -05:00
Rafael França
4de264db2a Merge pull request #23351 from y-yagi/remove_gsub_for_action_cable_meta_tag
remove unnecessary gsub for `action_cable_meta_tag`
2016-01-30 12:06:20 -05:00
Rafael França
ff835f9080 Merge pull request #23346 from kamipo/refactor_oid_money_precision
Refactor `OID::Money.precision`
2016-01-30 12:02:31 -05:00
Mikhail Dieterle
14037b8d8e [ci skip] fix typo 2016-01-30 19:32:23 +03:00
Ryuta Kamizono
d0054b4908 Fix bigint? for Enum columns in MySQL
Follow up to #22896.
2016-01-31 01:07:02 +09:00
Ryuta Kamizono
a3eba8f2b2 Remove unused LOST_CONNECTION_ERROR_MESSAGES
`LOST_CONNECTION_ERROR_MESSAGES` was added by f384582.
But currently unused from anywhere.
2016-01-31 00:29:40 +09:00
yui-knk
e05d828b1f There is no need to define test if a connection does not support primary_key 2016-01-31 00:01:26 +09:00
eileencodes
c4d85dfbc7 Handle response_body= when body is nil
There are some cases when the `body` in `response_body=` can be set to
nil. One of those cases is in `actionpack-action_caching` which I found
while upgrading it for Rails 5.

It's not possible to run `body.each` on a `nil` body so we have to
return after we run `response.reset_body!`.
2016-01-30 09:42:59 -05:00
yuuji.yaginuma
284f8d4970 remove unnecessary gsub for action_cable_meta_tag
If the specified `skip_action_cable` option, so as not to output the
`action_cable_meta_tag` in template, gsub is unnecessary.

ref: https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt#L6..L8
2016-01-30 23:14:19 +09:00
Ryuta Kamizono
4e551d05c9 Make SchemaMigration.drop_table to one SQL
`SchemaMigration.drop_table` is only used in tests.
Simply we can use `drop_table if_exists: true`.
2016-01-30 20:52:33 +09:00
Ryuta Kamizono
617a693458 Refactor column_exists? in SchemaStatements 2016-01-30 20:26:19 +09:00
yui-knk
8b9d217d08 Explicitly define columns method as an interface
`ActiveRecord::ConnectionAdapters::SchemaStatements#columns` is defined
here as an interface method here. So changes to raise `NotImplementedError`
same as `tables`, `views` ...etc.
2016-01-30 17:47:01 +09:00
Ryuta Kamizono
1a071bae04 Refactor OID::Money.precision 2016-01-30 17:09:03 +09:00
yuuji.yaginuma
92cca41bbe remove backward compatibility code for Minitest 4
The master branch is required Ruby 2.2.2+, for the Ruby 2.2 is bundled Minitest 5.4.3,
I think backward compatibility code for Minitest 4 is unnecessary.
2016-01-30 16:52:09 +09:00
yui-knk
444c4d05fe Warn if AR.primary_key is called for a table who has composite primary key
If `AR.primary_key` is called for a table who has composite primary key,
the method returns `nil`. This behavior sometimes generates invalid SQL.
The first time developers notice to invalid SQL is when they execute
SQL. This commit enables developers to know they are doing something
dangerous as soon as possible.
2016-01-30 16:47:51 +09:00
Prathamesh Sonpatki
b0ea06b3db [ci skip] Fix one more typo
- Followup of 10bc49710b
2016-01-30 12:02:21 +05:30
yui-knk
eba55447f0 [ci skip] Update internal documents about ActiveRecord's Reflection
ActiveRecord's Reflection was refactored by
f8d2899d12d59360f29c5eb6a1b1a8fe4ec82ca0 .
Top of ancestors chain was changed to `AbstractReflection` from
`MacroReflection`, and new Reflections were added.
2016-01-30 14:44:19 +09:00
yuuji.yaginuma
a027a750d0 remove unused require
`with_indifferent_access` had been used in `assigns` method, but has been removed in ca83436.
2016-01-30 13:50:22 +09:00
yuuji.yaginuma
647a04cdbc remove unused variable from render test
This removes the following warning.

```
rails/actionpack/test/controller/render_test.rb:278: warning: assigned but unused variable - response
```
2016-01-30 13:40:12 +09:00
Rafael França
6162c49e40 Merge pull request #23317 from rfmanuel/after-bundle-in-rails-plugin-template
Add an after_bundle callback in Rails plugin templates
2016-01-29 19:15:28 -05:00
schneems
5563c329ee Add Default Puma Config
When the `puma` command is run without any configuration options it will detect presence of a `config/puma.rb` file and use that. Currently there is discrepancy between `puma` command and `rails server` but Evan said it would be reasonable to add in reading in config from the default location. I am working on that right now as a feature in puma/puma.

Why do we need this? By default Puma uses 16 threads, and by default ActiveRecord only has 5 threads. Due to the architecture of AR it is guaranteed that if you're running with fewer DB connections than your server has threads you will hit `ActiveRecord::ConnectionTimeoutError ` eventually if your app gets modest amounts of traffic. Since we are providing a default webserver, we should provide reasonable configuration for that webserver.

This PR does a few things, first it sets the default Puma thread count to 5 to mach ActiveRecord's default. It sets the default environment to `"development"` and the default port to 300 so that booting the server with `$ puma` will give you the same default port as `rails server`. It is worth mentioning that by reading in from `PORT` environment variable this config can work with containerized deployments, such as on Heroku. 

We are not using worker processes by default, that way JRuby and windows devs can use this configuration without modification. I went ahead and included a default `on_worker_boot`. It won't be used unless a worker count is specified, that means this config will not use it. Even though it's not being used now It will make someone who wants to try modifying their config to run extra workers easier.

cc/ @pixeltrix
2016-01-29 15:58:37 -06:00
Jon Moss
513f72804d Merge pull request #23338 from tawan/update-doc-request-headers-access
Add additional documentation on Headers#[] [ci skip]
2016-01-29 16:24:46 -05:00
Matthew Draper
0ae187961c Use a gentler disconnect
The detach used by close! seems to be making EM very sad on Travis.
2016-01-30 07:51:41 +10:30
Tawan Sierek
349f187f58 Add additional documentation on Headers#[] [ci skip]
Issue #16519 covers confusion potentially caused by how HTTP
headers, that contain underscores in their names, are retrieved
through `ActionDispatch::Http::Headers#[]`.

This confusion has its origin in how a CGI maps HTTP header names
to variable names. Even though underscores in header names
are rarely encountered, they are valid according to RFC822 [1].
Nonetheless CGI like variable names, as requested by the Rack
specfication, will only contain underscores and therefore the
original header name cannot be recovered after the Rack server passed
on the environemnt hash. Please, see also the disscussion on
StackOverflow [2], which also links to an explaination in the
nginx documentation [3].

[1] http://www.ietf.org/rfc/rfc822.txt
[2] http://stackoverflow.com/questions/22856136/why-underscores-are-forbidden-in-http-header-names
[3] https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#missing-disappearing-http-headers
2016-01-29 22:11:16 +01:00
Matthew Draper
e6d0d4b1ae Don't bother stopping EM between tests
It's not strictly necessary, and maybe this will help with the current
test failure.
2016-01-30 06:41:14 +10:30
Matthew Draper
da6342779b Intervene on change_table as well as create_table 2016-01-30 05:45:41 +10:30
Rafael França
7d288244b2 Merge pull request #23336 from kesha-antonov/patch-1
remove require logging
2016-01-29 14:02:22 -05:00
Kesha Antonov
1c893bc2f9 remove require logging 2016-01-29 21:56:51 +03:00