Commit Graph

71773 Commits

Author SHA1 Message Date
George Claghorn c1e949e9e6 Prefer ImageProcessing's resize_to_limit macro over resize_to_fit
Don't upsize images smaller than the specified dimensions.
2019-01-24 11:46:42 -05:00
Ryuta Kamizono 1fecebae31 Allow `column_exists?` to be passed `type` argument as a string
Currently `conn.column_exists?("testings", "created_at", "datetime")`
returns false even if the table has the `created_at` column.

That reason is that `column.type` is a symbol but passed `type` is not
normalized to symbol unlike `column_name`, it is surprising behavior to
me.

I've improved that to normalize a value before comparison.
2019-01-24 19:02:44 +09:00
Yuji Yaginuma 4a40128a3f
Merge pull request #35040 from colorbox/fix_formatting_in_action_text_docs
Fix document formatting on Action Text docs [ci skip]
2019-01-24 18:03:50 +09:00
colorbox 91fc859016 Fix document formatting on Action Text docs [ci skip]
Use `+` instead of backquote.
2019-01-24 17:44:35 +09:00
Aaron Patterson c91c71fa15
Merge pull request #35031 from rails/view-ivar
Pass the view around instead of using an ivar
2019-01-23 13:40:24 -08:00
Xavier Noria 0065011660 Tell the user what to use instead of update_attributes/! 2019-01-23 22:26:22 +01:00
Ryuta Kamizono 060fe16447
Merge pull request #35029 from dylanahsmith/fix-strictly-cast-attribute-types
activerecord: Fix statement cache for strictly cast attributes
2019-01-24 05:36:13 +09:00
Aaron Patterson 1853b0d0ab
Pass the view around instead of using an ivar
If we pass the view instance around it's easier to understand the flow
control.
2019-01-23 12:17:30 -08:00
Dylan Thacker-Smith 5b58cc4f44 activerecord: Fix statement cache for strictly cast attributes 2019-01-23 14:49:42 -05:00
Rafael França d1456e3ad5
Merge pull request #34993 from schuetzm/allow-subdomains-of-localhost
Subdomains of localhost are safe against DNS rebinding
2019-01-23 13:15:15 -05:00
Kasper Timm Hansen 3aa094c527
Merge pull request #35027 from sponomarev/chore/fix-ac-test-typo
Fix attribute typo in ActionCable connection test request
2019-01-23 18:59:19 +01:00
Sergey Ponomarev c125990c7c
Fix attribute typo in ActionCable connection test request 2019-01-23 09:35:48 -05:00
Marc Schütz 4dfb1a3961 Subdomains of localhost are safe against DNS rebinding 2019-01-23 13:30:35 +01:00
George Claghorn 8642e3dce5
Merge pull request #35024 from calasyr/patch-1
Corrected spelling of ActionCable::Connection::TestCase [ci skip]
2019-01-22 20:25:46 -05:00
Alan Brown 6d6be1f194
Corrected spelling of ActionCable::Connection::TestCase 2019-01-22 16:19:09 -08:00
Rafael França afbab2822a
Merge pull request #35018 from gmcgibbon/revert_redirect_to_allow_other_host
Revert ensure external redirects are explicitly allowed
2019-01-22 15:35:57 -05:00
Rafael França ea6a488f51
Merge pull request #35010 from Edouard-chin/ec-numericality-validator-fix
Fix NumericalityValidator on object responding to `to_f`:
2019-01-22 15:33:54 -05:00
Ryuta Kamizono 0815474d2f
Merge pull request #35017 from yahonda/mysql8014
MySQL 8.0.14 adds `ER_FK_INCOMPATIBLE_COLUMNS`
2019-01-23 04:52:44 +09:00
Edouard CHIN f01e38509c Fix NumericalityValidator on object responding to `to_f`:
- If you had a PORO that acted like a Numeric, the validator would
  work correctly because it was previously using `Kernel.Float`
  which is implicitely calling `to_f` on the passed argument.

  Since rails/rails@d126c0d , we are now using `BigDecimal` which does
  not implicitely call `to_f` on the argument, making the validator
  fail with an underlying `TypeError` exception.

  This patch replate the `is_decimal?` check with `Kernel.Float`.
  Using `Kernel.Float` as argument for the BigDecimal call has two
  advantages:

  1. It calls `to_f` implicetely for us.
  2. It's also smart enough to detect that `Kernel.Float("a")` isn't a
     Numeric and will raise an error.
     We don't need the `is_decimal?` check thanks to that.

  Passing `Float::DIG` as second argument to `BigDecimal` is mandatory
  because the precision can't be omitted when passing a Float.
  `Float::DIG` is what is used internally by ruby when calling
  `123.to_d`

  https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/lib/bigdecimal/util.rb#L47

- Another small issue introduced in https://github.com/rails/rails/pull/34693
  would now raise a TypeError because `Regexp#===` will just return
  false if the passed argument isn't a string or symbol, whereas
  `Regexp#match?` will.
2019-01-22 20:46:16 +01:00
Rafael França 1d359d4bf6
Merge pull request #35020 from alkesh26/ationpack-typo-fixes
Actionpack typo fixes.
2019-01-22 14:02:42 -05:00
Aaron Patterson db4b77aca1
Merge pull request #34952 from rails/template-stuff
Template Handler Refactoring
2019-01-22 09:28:08 -08:00
alkesh26 78cf58b765 1. Replaced unused variables by `_`.
2. Typo fixes.
2019-01-22 22:27:01 +05:30
Gannon McGibbon 2e0ca9284a Revert ensure external redirects are explicitly allowed 2019-01-22 11:40:13 -05:00
Eileen M. Uchitelle e26f0658da
Merge pull request #34997 from alkesh26/typo-fix-webserver
Replaced webserver with web server
2019-01-22 11:13:37 -05:00
alkesh26 97909ddcf2 Changed webserver to web server. 2019-01-22 21:11:03 +05:30
Yasuo Honda 3ea3cccc93 MySQL 8.0.14 adds `ER_FK_INCOMPATIBLE_COLUMNS`
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-14.html
> Error messages relating to creating and dropping foreign keys
> were improved to be more specific and informative. (Bug #28526309, Bug #92087)

https://dev.mysql.com/doc/refman/8.0/en/server-error-reference.html

> Error number: 3780; Symbol: ER_FK_INCOMPATIBLE_COLUMNS; SQLSTATE: HY000
> Message: Referencing column '%s' and referenced column '%s' in foreign key constraint '%s' are incompatible.
> ER_FK_INCOMPATIBLE_COLUMNS was added in 8.0.14.
2019-01-22 15:15:52 +00:00
Ryuta Kamizono 3f0c7c5580
Merge pull request #35006 from kddeisz/alias-case-nodes
Alias case nodes
2019-01-22 06:54:41 +09:00
Andrew White 4f62e757ca
Merge pull request #34990 from rails/fix-time-multiparameter-casting
Fix year value when casting a multiparameter time hash
2019-01-21 20:26:45 +00:00
Kevin Deisz 65cec345b4
Alias case nodes
When `Arel` was merged into `ActiveRecord` we lost the ability to alias case nodes. This adds it back.
2019-01-21 10:28:39 -05:00
Ryuta Kamizono feb97dfabd
Merge pull request #35005 from bogdanvlviv/add-chanel-tests-to-rails-stats
Add Channel tests to `rails stats`
2019-01-21 20:36:29 +09:00
Ryuta Kamizono 98ebebde86
Merge pull request #35004 from bogdanvlviv/add-missing-entries-to-guides-changelog-file
Add missing entries to guides' changelog file [ci skip]
2019-01-21 20:36:09 +09:00
bogdanvlviv 7ec67c1d31
Add Channel tests to `rails stats`
Rails generates `test/channels`(#34933) and
even allows `rails test:channels` (#34947).
`rails stats` has been providing info about `app/channels`,
it makes sense to add `test/channels` as well.

(I've changed test because we generate `test/channels` with some code)
2019-01-21 10:45:08 +00:00
Andrew White ccdedeb9d5
Fix year value when casting a multiparameter time hash
When assigning a hash to a time attribute that's missing a year
component (e.g. a `time_select` with `:ignore_date` set to `true`)
then the year defaults to 1970 instead of the expected 2000. This
results in the attribute changing as a result of the save.

Before:

    event = Event.new(start_time: { 4 => 20, 5 => 30 })
    event.start_time # => 1970-01-01 20:30:00 UTC
    event.save
    event.reload
    event.start_time # => 2000-01-01 20:30:00 UTC

After:

    event = Event.new(start_time: { 4 => 20, 5 => 30 })
    event.start_time # => 2000-01-01 20:30:00 UTC
    event.save
    event.reload
    event.start_time # => 2000-01-01 20:30:00 UTC
2019-01-21 09:23:12 +00:00
bogdanvlviv 0bc62b9c27
Add missing entries to guides' changelog file [ci skip]
We added "Action Mailbox Basics", "Action Text Overview" guides(#34812, #34878)
I think it makes to mention about it in the changelog file. (Similar to 7200ec92f8)
Note that entries retain original author since
I just moved content from readme files to the guides.
2019-01-21 09:16:51 +00:00
George Claghorn 9f0953d320
Merge pull request #34982 from takeyuweb/fix_activestorage_allow_other_host
Fix ArgumentError when using S3Service
2019-01-21 01:36:30 -05:00
Yuichi Takeuchi ee65ca46e5 Fix ArgumentError: Unsafe redirect 2019-01-21 14:15:34 +09:00
Ryuta Kamizono 2a711ddbc8
Merge pull request #34991 from mcgregordan/mailbox-statistics
Report statistics for app/mailboxes
2019-01-20 21:15:02 +09:00
Dan McGregor cc8c72a4bd Report statistics from ActionMailbox 2019-01-20 11:15:20 +00:00
Ryuta Kamizono 31e118c39d
Merge pull request #34988 from bogdanvlviv/fix-development_dependencies_install
Update "Development Dependencies Install" guide [ci skip]
2019-01-20 11:45:15 +09:00
Ryuta Kamizono 4a0e3809be Fix type casting column default in `change_column`
Since #31230, `change_column` is executed as a bulk statement.

That caused incorrect type casting column default by looking up the
before changed type, not the after changed type.

In a bulk statement, we can't use `change_column_default_for_alter` if
the statement changes the column type.

This fixes the type casting to use the constructed target sql_type.

Fixes #34938.
2019-01-20 11:09:00 +09:00
bogdanvlviv 535af8798c
Fix "Development Dependencies Install" guide [ci skip]
Since we use [workspaces](https://yarnpkg.com/lang/en/docs/workspaces/)
`yarn install` from the root should install all the javascript dependencies.
2019-01-19 23:28:25 +00:00
George Claghorn dd8d37881c
Merge pull request #34986 from alkesh26/action-mailbox-layout-fix
Enclosing body tag in conductor layout.
2019-01-19 15:14:08 -05:00
alkesh26 b8e0333845 enclosing body tag in conductor layout. 2019-01-20 00:58:06 +05:30
George Claghorn aac4d7f6ff Check all provided attributes of the message 2019-01-19 11:49:50 -05:00
George Claghorn c2c10f9262
Merge pull request #34984 from takeyuweb/fix-actionmailbox-create-inbound-emails
Fix that adding attachments lose a body
2019-01-19 11:18:32 -05:00
Yuichi Takeuchi 88453093d5 Fix that adding attachments lose a body 2019-01-19 23:28:41 +09:00
Ryuta Kamizono 9608b180bf
Merge pull request #34981 from koic/bump_rubocop_to_0_63_0
Bump RuboCop to 0.63.0
2019-01-19 19:33:59 +09:00
Koichi ITO 43a9f4f7ca Bump RuboCop to 0.63.0
### Summary

RuboCop 0.63.0 has been released.
https://github.com/rubocop-hq/rubocop/releases/tag/v0.63.0

And rubocop-0-63 channel is available in Code Climate.
https://github.com/codeclimate/codeclimate/releases/tag/v0.83.0

Currently, RuboCop version specified for Gemfile.lock (0.61) and
Code Climate (0.60) are different.

- https://github.com/rails/rails/blob/v6.0.0.beta1/Gemfile.lock#L407
- https://github.com/rails/rails/blob/v6.0.0.beta1/.codeclimate.yml#L26

This PR matches these versions to 0.63.
2019-01-19 18:52:09 +09:00
Ryuta Kamizono 9f203c3f81 Single new line is not rendered as new line in the CHANGELOG.md
https://github.com/rails/rails/blob/v6.0.0.beta1/actionview/CHANGELOG.md

[ci skip]
2019-01-19 18:18:05 +09:00
Aaron Patterson 0f081611e6
Ask the view for its method container
Rather than doing is_a? checks, ask the view object for its compiled
method container.  This gives us the power to replace the method
container depending on the instance of the view.
2019-01-18 15:54:37 -08:00