Commit Graph

825 Commits

Author SHA1 Message Date
Prathamesh Sonpatki
b417e0b753 nodoc ActionView::ModelNaming module
- Its only used by ActionView internals and not supposed to be used
  through public API.
2015-01-18 11:57:36 +05:30
Yuki Nishijima
08eafc9646 Eliminate a ruby warning in a test in Action View
This eliminates the warning below:

  actionview/test/template/form_helper_test.rb:913: warning: method redefined; discarding old id_came_from_user?
  actionview/test/template/form_helper_test.rb:104: warning: previous definition of id_came_from_user? was here
2015-01-17 09:44:31 -08:00
Daniel Gomez de Souza
6ba4c6d497 Use option url: false to allow entries without a link tag 2015-01-16 16:28:54 -02:00
Sean Griffin
d8e710410e Only use the _before_type_cast in the form when from user input
While we don't want to change the form input when validations fail,
blindly using `_before_type_cast` will cause the input to display the
wrong data for any type which does additional work on database values.
2015-01-14 17:08:25 -07:00
Sean Griffin
b67990cf34 Add tests with an explanation of why we're using _before_type_cast
If you entered incorrect input into a form (particularly with a
numericality validation), we should not replace what you typed in with
`0`, since clicking submit a second time would essentially be the same
as erroneously accepting the junk input as 0.
2015-01-14 16:46:04 -07:00
Sean Griffin
99b6cf5381 Revert "Don't use the _before_type_cast version of attributes in the form"
This reverts commit 787e22bb491bd8c36db1e9734261c4ce02c5c5fd.
2015-01-14 16:44:06 -07:00
Sean Griffin
787e22bb49 Don't use the _before_type_cast version of attributes in the form
We should never be ignoring valuable information that the types may need
to give us. The reason that it originally used `_before_type_cast` is
unclear, but appears to date back long enough that the reasons may not
be relevant today. There is only one test that asserts that it uses the
before type cast version, but it gives no context as to why and uses a
mock which does not simulate the real world.

Fixes #18523.
2015-01-14 15:42:24 -07:00
Prathamesh Sonpatki
6ff026a1cd Fix typo in ActionView CHANGELOG [ci skip] 2015-01-14 16:34:09 +05:30
Kuldeep Aggarwal
90aef23e38 No need of requiring rbconfig, it is by-default loaded 2015-01-10 20:27:18 +05:30
Rafael Mendonça França
1c8192669f Avoid changing the global state on the tests 2015-01-05 14:39:52 -03:00
Rafael Mendonça França
d76bf34b04 Merge pull request #17676 from tigrish/fix_custom_i18n_exception_handler_regression
Fix I18n regression introduced by #13832
2015-01-05 14:35:50 -03:00
Rafael Mendonça França
9644cdcd3d Merge pull request #18328 from brainopia/remove_tz_proxy
Use directly TZInfo::Timezone without proxy
2015-01-04 18:42:40 -03:00
Rafael Mendonça França
2bf8b5b6ec Remove wrong TODO comment 2015-01-04 15:54:22 -03:00
Rafael Mendonça França
dc7ed96adc Remove version conditional for find_template_paths
Now that we only support Ruby 2.2+ we don't need this conditional
anymore
2015-01-04 15:54:21 -03:00
brainopia
ab4c900656 Use directly TZInfo::Timezone without proxy
Since real timezone is loaded anyway in `#utc_offset`
which is called during `#create`
2015-01-04 20:08:18 +03:00
claudiob
adfeeb01e7 Remove unneeded require 'as/deprecation'
Tests should still pass after removing `require 'active_support/deprecation'`
from these files since the related deprecations have been removed.
2015-01-04 07:45:07 -08:00
Rafael Mendonça França
bf7b8c193f Remove unneeded requires
These requires were added only to change deprecation message
2015-01-04 12:11:03 -03:00
Rafael Mendonça França
4be859f0fd Change the default template handler from ERB to Raw.
Files without a template handler in their extension will be rended
using the raw handler instead of ERB.
2015-01-04 11:58:42 -03:00
Rafael Mendonça França
34bcbcf357 Remove deprecated AbstractController::Base::parent_prefixes 2015-01-04 11:58:42 -03:00
Robin Dupret
9b9ec0ded4 Fix a few typos [ci skip] 2015-01-03 16:36:33 +01:00
Vijay Dev
4b9dba99d6 Merge branch 'master' of github.com:rails/docrails 2015-01-03 14:58:17 +00:00
Justin Coyne
fab50c130b Unsafe default translations should not be marked html_safe
Previously default translation keys that didn't end in `_html`, but came
after a missing key that ended in `_html` were being returned as
html_safe. Now they are not. Fixes #18257
2015-01-02 17:07:01 -06:00
Robin Dupret
843fc99786 Follow up to #17973 [ci skip] 2015-01-02 20:26:39 +01:00
Rafael Mendonça França
873870df4c Merge pull request #17974 from killthekitten/fix-render-block
Make possible to use blocks with short version of render partial

Conflicts:
	actionview/CHANGELOG.md
2015-01-02 14:12:23 -03:00
Rafael Mendonça França
c455817804 Merge pull request #17973 from maurogeorge/file_field_hidden_field
Generate a hidden_tag when using a file_field
2015-01-02 13:57:33 -03:00
Mauro George
00b26532f0 Add a hidden_field on the file_field
This will avoid a error be raised when the only input on the form is the
`file_field`.
2015-01-02 12:15:03 -02:00
Robin Dupret
24637e577c Merge pull request #18271 from arunagw/change-copyright-year
Update copyright notices to 2015 [ci skip]
2015-01-01 00:08:17 +01:00
Robin Dupret
ae08bef428 Changelog edits [ci skip] 2014-12-31 17:35:41 +01:00
Arun Agrawal
4de18d0ead Update copyright notices to 2015 [ci skip] 2014-12-31 08:34:14 +01:00
Ben Woodall
7b4c6dca43 Fixes simple missprint in docs for #cyle in text_helper 2014-12-30 12:09:47 -08:00
Robin Dupret
20ea1a2adf Tiny documentation fixes [ci skip] 2014-12-30 17:00:40 +01:00
Robin Dupret
0c937b6d1e Merge pull request #18130 from claudiob/better-record-identifier-doc
Better docs for AV::RecordIdentifier [ci skip]
2014-12-30 16:55:16 +01:00
Rafael Mendonça França
0c070ae568 Merge pull request #18251 from tjgrathwell/fix-polymorphic-routes-to-model
Fix form_for to work with objects that implement to_model
2014-12-30 11:23:47 -03:00
Rafael Mendonça França
ecb1981bfd Template lookup now respect default locale and I18n fallbacks.
Given the following templates:

    mailer/demo.html.erb
    mailer/demo.en.html.erb
    mailer/demo.pt.html.erb

Before this change for a locale that doesn't have its related file
the `mailer/demo.html.erb` will
be rendered even if `en` is the default locale.

Now `mailer/demo.en.html.erb` has precedence over the file without
 locale.

Also, it is possible to give a fallback.

    mailer/demo.pt.html.erb
    mailer/demo.pt-BR.html.erb

So if the locale is `pt-PT`, `mailer/demo.pt.html.erb` will be
 rendered given the right I18n fallback configuration.

Fixes #11884.
2014-12-29 23:48:35 -03:00
Travis Grathwell
3efd90ac5b Fix form_for to work with objects that implement to_model
Previously, if you tried to use form_for with a presenter object
that implements to_model, it would crash in
action_dispatch/routing/polymorphic_routes.rb when asking the presenter
whether it is .persisted?

Now, we always ask .persisted? of the to_model object instead.

This seems to been an issue since 1606fc9d840da869a60213bc889da6fcf1fdc431

Signed-off-by: Eugenia Dellapenna <eugenia.dellapenna@gmail.com>
2014-12-29 18:12:03 -08:00
Angelo capilleri
c85fed05c5 fix error message of option as with invalid charters in partial rendering
before this PR IDENTIFIER_ERROR_MESSAGE could lead to misunderstand the convention of partial name.
Added OPTION_AS_ERROR_MESSAGE for unvalid charter in as option.
2014-12-29 20:59:57 -03:00
claudiob
d3b098b828 Require Ruby 2.2 for Rails 5.0
Stems from [this comment](https://github.com/rails/rails/pull/18203#issuecomment-68138096) by @robin850
and by the blog post http://weblog.rubyonrails.org/2014/12/19/Rails-4-2-final
2014-12-26 13:53:09 +01:00
claudiob
8a950a5038 Fix "Rendering" not to link to AV::Rendering
The "Rendering" word in the titles is not meant to be a link to
the documentation for ActionView::Rendering.

[ci skip]
2014-12-25 02:12:52 +01:00
Sean Griffin
dbdb104076 Merge pull request #18107 from mkdynamic/add-reply-to-mail-to
Add support for Reply-To field in mail_to helper
2014-12-24 07:10:53 -07:00
Sean Griffin
21289bed3b Merge pull request #18166 from merongivian/search_field_refactor
Remove block from super
2014-12-23 08:37:17 -07:00
Jose Añasco
96f0aad6ec Remove block from super 2014-12-23 09:38:44 -05:00
claudiob
943ebcb5f1 Better docs for AV::RecordIdentifier
This commit intends to clarify the scope of ActionView::RecordIdentifier
methods `dom_id` and `dom_class`.

Most of the current documentation comes from da257eb8 (7 years ago) when
the decoupling of ActionView, ActiveRecord and ActiveModel was not a concern.

Since then, steps have been taken to reach such decoupling, especially
8ca17926 which duplicated ActionController::ModelNaming into
ActionView::ModelNaming explaining that:

> These are just a simple helpers for decoupling Active Model, so it does not
> make sense to extract it to Active Support, but the point is to decouple also
> Action View and Action Pack

As of today, ActionView::RecordIdentifier only includes `dom_id` and `dom_class`
so it makes sense to explicitly document those two methods, and leaving the
details of helpers like `div_for` in the corresponding files.

Moreover, I think it's important to mention in the documentation that
ActionView::RecordIdentifier **does not strictly depend on the ActiveRecord API**: any class `Post` implementing `post.to_key` and `post.model_name.param_key` will work.

[ci skip]
2014-12-23 02:01:53 +01:00
claudiob
b26338e83b Better tests for AV::RecordIdentifier
This commit intends to clarify the scope of ActionView::RecordIdentifier
methods `dom_id` and `dom_class`.

Most of the current documentation comes from da257eb8 (7 years ago) when
the decoupling of ActionView, ActiveRecord and ActiveModel was not a concern.

Since then, steps have been taken to reach such decoupling.
Therefore I think it's important to show that ActionView::RecordIdentifier
**does not strictly depend on the ActiveRecord API**:
any class `Post` implementing `post.to_key` and `post.model_name.param_key`
will work.

This commit adds a test to prove that ActionView::RecordIdentifier methods
can also be used on objects that do not subclass ActiveRecord::Base.
2014-12-23 01:59:25 +01:00
claudiob
7375c17114 Remove unused Sheep fixture from AV
The `Sheep` fixture was added in eb23754e when moving template tests
from actionpack to actionview, but it's not actually used in ActionView tests.

The `Sheep` fixture is only used to test `uncountable` in ActiveModel tests,
and is already defined in activemodel/test/models/sheep.rb
2014-12-22 04:02:35 +01:00
Mark Dodwell
fecbed6fb1 Add support for Reply-To field in mail_to helper 2014-12-20 15:50:09 -08:00
Nikolay Shebanov
f02a35b86e Make possible to use blocks with short version of render partial 2014-12-19 13:52:12 +01:00
yui-knk
609d3a8475 [ci skip] Fix HTML format on comment 2014-12-18 13:07:32 +09:00
Jon Atack
2038c2c53d Test to ensure content_tag works when fixing #17661
After c2fe093, which was reverted yesterday, there will likely be
future PRs to address #17661.

The test `actionview/test/template/capture_helper_test.rb
#test_capture_returns_nil_if_the_returned_value_is_not_a_string` should
have errored with c2fe093, but it was rewritten in the PR to not raise.
My guess is that it may have seemed irrelevant to the content_tag tests
or already covered by them.

This test provides additional protection by being in the content_tag
test suite to explicitly raise a red flag in future cases. It foregoes
some redundancy for safety — at least until #17661 is closed.
2014-12-16 17:37:26 +01:00
Santiago Pastorino
ecb26b736e Regression test for #18024 2014-12-15 21:34:15 -02:00
Santiago Pastorino
e4627edf87 Revert "Re-enable capture'ing non-String values"
This reverts commit c2fe0938d7201d4ce0bb2f25e72bf5f70df128af.
2014-12-15 21:20:54 -02:00