Commit Graph

45618 Commits

Author SHA1 Message Date
@schneems and @sgrif
2bbcca004c Deprecate *_path methods in mailers
Email does not support relative links since there is no implicit host. Therefore all links inside of emails must be fully qualified URLs. All path helpers are now deprecated. When removed, the error will give early indication to developers to use `*_url` methods instead.

Currently if a developer uses a `*_path` helper, their tests and `mail_view` will not catch the mistake. The only way to see the error is by sending emails in production. Preventing sending out emails with non-working path's is the desired end goal of this PR.

Currently path helpers are mixed-in to controllers (the ActionMailer::Base acts as a controller). All `*_url` and `*_path` helpers are made available through the same module. This PR separates this behavior into two modules so we can extend the `*_path` methods to add a Deprecation to them. Once deprecated we can use this same area to raise a NoMethodError and add an informative message directing the developer to use `*_url` instead.

The module with warnings is only mixed in when a controller returns false from the newly added `supports_relative_path?`.

Paired @sgrif & @schneems
2014-07-30 12:01:45 -05:00
Santiago Pastorino
4efb36e7b4 Revert "Merge pull request #15305 from tgxworld/remove_unnecessary_require"
This reverts commit f632f79b8dcd144408c66a544984b2ba9cf52f87, reversing
changes made to 98c7fe87690ca4de6c46e8f69806e82e3f8af42d.

Closes #16343
2014-07-30 09:46:33 -03:00
Rafael Mendonça França
74c31ac5fe Merge pull request #15959 from aditya-kapoor/remove-unneeded-cases
remove unneeded test model for ActiveModel test cases.
2014-07-29 18:08:07 -03:00
David Heinemeier Hansson
c56997eb1b Merge pull request #16339 from rwz/with_options_implicit
Add implicit receiver support to `Object#with_options`
2014-07-29 13:38:24 -07:00
Pavel Pravosud
0cb3cc4ff7 Add implicit receiver support to Object#with_options 2014-07-29 16:11:48 -04:00
Rafael Mendonça França
160cc6956c Merge pull request #16335 from arthurnn/rm_parent_state_trasaction
Remove @state.parent assignment on commit
2014-07-29 16:24:17 -03:00
Aaron Patterson
d7b726be00 oops! 💣
use helpers.include? so we don't get any false positives
2014-07-29 12:18:21 -07:00
Aaron Patterson
f889831ed6 ask the named routes collection if the route is defined
we should not be accessing internals to figure out if a method is
defined.
2014-07-29 12:15:04 -07:00
Aaron Patterson
0088b08dca helpers should be a Set so it doesn't grow unbounded
since helpers is a set, we can be confident about when to remove methods
from the module.
2014-07-29 11:48:14 -07:00
Aaron Patterson
41931b8af1 pass the module to define_named_route_methods
after this, we can disconnect @module from the instance
2014-07-29 11:32:17 -07:00
Aaron Patterson
a2e926698d only ask for the routes module once
we can cache the module on the stack, then reuse it
2014-07-29 11:28:45 -07:00
Aaron Patterson
d2d3376903 eval_block should be private 2014-07-29 11:07:43 -07:00
Zachary Scott
a240ad0c89 💅 from #16329 [ci skip] 2014-07-29 10:28:56 -07:00
Zachary Scott
89ad1d85aa Merge pull request #16329 from deependersingla/master
GET request should not write to database note added. [ci skip]
2014-07-29 10:27:33 -07:00
Deepender Singla
3d42330048 Get request should not write to database note added. [skip ci] 2014-07-29 22:48:50 +05:30
Rafael Mendonça França
d035124a20 Merge pull request #16336 from akshay-vishnoi/fix-tests
Add missing test case for Array#to_sentence, collect all test cases for Object#to_param at one place and avoid repitition
2014-07-29 11:48:46 -03:00
Arthur Neves
dd9829a9ea
Remove @state.parent assignment on commit
This piece of code was introduced on
67d8bb963d5d51fc644d6b1ca20164efb4cee6d7 , which was calling
`committed?` in the `transaction_state` before calling the `committed!`
method. However on 7386ffc781fca07a0c656db49fdb54678caef809, the
`committed?` check was removed and replaced by a `finalized?`, which
only checks if the state is not nil. Thus we can remove that line.
2014-07-29 10:38:11 -04:00
Akshay Vishnoi
6bc7e27c19 Add missing test case for Array#to_sentence, collect all test cases for Object#to_param at one place and avoid repitition 2014-07-29 20:05:36 +05:30
Rafael Mendonça França
8426897086 Merge pull request #16334 from akshay-vishnoi/array-tests
Move array test files under array
2014-07-29 10:59:53 -03:00
Yves Senn
aade0a0412 docs, cleanup mixed indents within form_options_helper.rb RDoc.
[ci skip]

This fixes the broken code block rendering and indents the examples
within the parameter list.
2014-07-29 14:57:48 +02:00
Akshay Vishnoi
00979fdb2c Move array test files under array 2014-07-29 18:13:52 +05:30
Robin Dupret
c5fc7b5564 Merge pull request #16332 from shizm/fix-docs-validates-uniqueness-of
[ci skip] fix doc typo for validates_uniqueness_of
2014-07-29 13:24:16 +02:00
Satoru Yamasaki
7413eeee36 [ci skip] fix doc typo for validates_uniqueness_of 2014-07-29 20:07:17 +09:00
Yves Senn
94abb92c8d Merge pull request #16328 from noinkling/template_password_confirmation_fix
Give password_confirmation div the "field" class in the scaffold generator "_form" partial
2014-07-29 12:22:22 +02:00
Godfrey Chan
540bc3d9b1 Merge pull request #16148 from rails/fix_json_autoload
Fix json autoload
2014-07-29 01:35:49 -07:00
Yves Senn
b8120ab14d Raise an exception when attachments are added after mail was called.
Closes #16163

Adding attachments after a call to `mail` will result in invalid emails.
This is related to the fact, that `mail` is making the required preparations
before the email is ready to be sent. These change depending on your
added attachments.
2014-07-29 09:24:06 +02:00
Godfrey Chan
bf7fbe64f7 Fixed a compatibility issue with the Oj gem
`Time#as_json`, `Date#as_json` and `DateTime#as_json` incorrectly depends on a
delegation that is set up in `active_support/json/encoding`. We cannot simply
require that file in `core_ext/object/json` because it would cause a circular
dependency problem (see #12203 for background). We should instead rely on AS's
autoload to load that file for us on-demand.

To trigger autoload correctly, we need to reference the `AS::JSON::Encoding`
constant instead of using the delegated version.

Fixes #16131.
2014-07-29 00:04:45 -07:00
Godfrey Chan
5de072c730 Added failing test case for #16131 2014-07-29 00:04:36 -07:00
noinkling
ed29c0a96b Give password_confirmation div the "field" class in erb form template 2014-07-29 16:16:31 +12:00
Rafael Mendonça França
6924f848c4 Merge pull request #15629 from akshay-vishnoi/test-to_param
Define Hash#to_query and set Hash#to_param as alias to it; with test cases
2014-07-28 20:51:21 -03:00
Rafael Mendonça França
3ac731c4d0 Merge pull request #15658 from akshay-vishnoi/object-tests
Move object test files under object
2014-07-28 20:42:27 -03:00
Akshay Vishnoi
a45d1f6dfd Move object test files under object 2014-07-29 05:01:50 +05:30
Rafael Mendonça França
55cedf288e Merge pull request #16326 from itsNikolay/remove_blank_lines
remove blank lines at the start of the ActiveRecord files
2014-07-28 20:15:52 -03:00
Ponomarev Nikolay
2a7cf24cb7 remove blank lines in the start of the ActiveRecord files 2014-07-29 02:51:08 +04:00
Aaron Patterson
9f63a78d55 remove the mounted? method
we know the routes should not be "optimized" when mounting an
application
2014-07-28 14:07:53 -07:00
Aaron Patterson
099fd0efc4 remove some caching
this caching doesn't increase performance, but does increase complexity.
remove it for now and find better ways to speed up this code.
2014-07-28 13:57:05 -07:00
Rafael Mendonça França
6f66e7313b Merge pull request #16305 from tomkadwill/documented_change_table
Added documentation for change_table
2014-07-28 15:07:30 -03:00
Rafael Mendonça França
f5cec76ea8 Extract the transaction class to a local variable 2014-07-28 15:04:31 -03:00
Rafael Mendonça França
6501aeb286 Merge pull request #16284 from arthurnn/transactions
Transactions refactoring
2014-07-28 15:02:28 -03:00
Arthur Neves
d37bcc1d5a
savepoint_name should return nil for non-savepoint transactions
Also add test to assets the savepoint name
2014-07-28 13:51:59 -04:00
Arthur Neves
97bb76dc28
Transactions refactoring
Add a transaction manager per connection, so it can controls the
connection responsibilities.

Delegate transaction methods to transaction_manager
2014-07-28 13:51:44 -04:00
Rafael Mendonça França
4e116c56a8 Fix typo and remove code block since present is not a method. 2014-07-28 13:44:37 -03:00
Yves Senn
a09f025758 docs, clarify attribute query methods on numeric columns. Closes #16246.
[ci skip]
2014-07-28 17:30:43 +02:00
Yves Senn
171818c60c Merge pull request #16303 from rajcybage/removing_master
remove empty unused method
2014-07-28 17:22:53 +02:00
Tom Kadwill
9fb2fdc913 Added nodoc to change_table 2014-07-28 15:46:57 +01:00
Rafael Mendonça França
64e2e81bf9 Merge pull request #16297 from calebthompson/extract-iterator-method
Extract iterator method in AR::SchemaDumper
2014-07-28 10:58:23 -03:00
Rafael Mendonça França
7bd0af42d6 Merge pull request #16295 from kenn/no_stacktrace_drop_task
No verbose backtrace by db:drop when database does not exist.
2014-07-28 10:42:58 -03:00
Yves Senn
473819985a Merge pull request #16318 from zuhao/refactor_activerecord_adapter_test
make `adapter_test` run order independently.
2014-07-28 15:12:02 +02:00
Zuhao Wan
be58912c84 Add where condition so select_one returns the correct record. 2014-07-28 20:05:32 +08:00
Yves Senn
362cbabf3f Merge pull request #16319 from Domon/fix-each-validator-example
Fix example code of EachValidator [ci skip]
2014-07-28 14:00:40 +02:00