Commit Graph

8981 Commits

Author SHA1 Message Date
Rafael Mendonça França
2c2b0beaf4 Add :escape option for truncate
This options can be used to not escape the result by default.
2012-05-26 14:27:07 -03:00
Rafael Mendonça França
eedc513503 Update the documentation and add CHANGELOG entry 2012-05-26 13:59:47 -03:00
Rafael Mendonça França
4ce3b5d6fe Test that the block used in truncate is escaped if it is not HTML safe
Refactoring the truncate method to not do a sort-circuit return
2012-05-26 13:57:15 -03:00
Li Ellis Gallardo
38813da6dc Truncate now has the ability to receive a html option that allows it to call rails helpers.
This way if my text is long I don't have to do something like this:

.text
= truncate(@text, :length => 27)

 if @text.size >= 27
    = link_to "continue", notes_path, ....."")
2012-05-26 10:24:17 -05:00
Vijay Dev
575e77ba16 Merge branch 'master' of github.com:lifo/docrails 2012-05-26 17:49:59 +05:30
Mikhail Vaysman
17eedd8e07 references to the old behavior removed 2012-05-25 16:58:43 +04:00
José Valim
73db73fee9 Remove implicit dependency on pathname 2012-05-25 09:27:39 +02:00
Vijay Dev
91305adef8 Merge branch 'master' of github.com:lifo/docrails 2012-05-23 23:26:39 +05:30
Vijay Dev
1ad0b378cc Revert "Remove blank trailing comments"
This reverts commit fa6d921e11363e9b8c4bc10f7aed0b9faffdc33a.

Reason: Not a fan of such massive changes. We usually close such changes
if made to Rails master as a pull request. Following the same principle
here and reverting.

[ci skip]
2012-05-23 22:43:08 +05:30
Vijay Dev
2642c2961c copy edit[ci skip] 2012-05-23 22:42:49 +05:30
Matt Griffin
6c7b250ac0 Add license field to gemspecs, by Matt Griffin 2012-05-23 09:22:25 -07:00
José Valim
cb92efbf04 Merge pull request #6453 from parndt/session_keys
Added session.keys and session.values back to ActionDispatch::Request::Session
2012-05-22 22:49:14 -07:00
David Morton
2227064b2a Fix incorrect example for fields_for - without the '=' it will not output anything. 2012-05-22 22:00:31 -05:00
Philip Arndt
6ac458d341 Added ActionDispatch::Request::Session#keys and ActionDispatch::Request::Session#values 2012-05-23 14:47:30 +12:00
Carlos Galdino
30847b499b Add tests for time_field and date_field helpers
These tests check the values of 'min' and 'max' input attrs
2012-05-22 23:33:07 -03:00
Carlos Galdino
a9a9e8a3cb Refactor date related helpers 2012-05-22 23:32:29 -03:00
Jeremy Kemper
65d2a60a8c Merge pull request #6359 from carlosgaldino/add-html5-inputs
Add HTML5 color and date/time inputs
2012-05-22 16:17:40 -07:00
Philip Arndt
40c0b3a25d Fixed typo new_defautls -> new_defaults.
* Added tests for 'else' case in ActionView::Helpers::TranslationHelper#wrap_translate_defaults
* Also updated the testing syntax of translation.html_safe? asserts to provide better output upon failure.
2012-05-23 11:04:15 +12:00
Carlos Antonio da Silva
c5fc159949 Merge pull request #6429 from marcandre/fix_test_request
Fix bug when Rails.application is defined but is nil. See #881
2012-05-21 15:34:51 -07:00
Alexey Vakhov
e4569b50d1 Add instance_accessor option to class_attribute 2012-05-22 00:28:34 +04:00
Carlos Galdino
b02d14aad5 Add several HTML5 input helpers
The input types added are:

- input[type="month"]

- input[type="week"]

- input[type="datetime"]

- input[type="datetime-local"]
2012-05-21 17:23:56 -03:00
Carlos Galdino
1ce4b5b33d Add HTML5 input[type="color"] helper 2012-05-21 17:23:48 -03:00
Marc-Andre Lafortune
89ebd28d4e Fix bug when Rails.application is defined but is nil. See #881 2012-05-21 15:24:18 -04:00
José Valim
776ea1090f Revert "Merge pull request #6425 from pinetops/resolver_concurrency_fix"
This reverts commit 254c04286c5916ae7f91eb6e173b312e7a74e364, reversing
changes made to 513a0525c24c2944630acfa465b22cd2f4601adf.
2012-05-21 21:01:02 +02:00
Aaron Patterson
254c04286c Merge pull request #6425 from pinetops/resolver_concurrency_fix
Resolver concurrency fix
2012-05-21 11:29:25 -07:00
Tom Clarke
719b008f1d More granular locking of the Resolver template cache
In order to avoid holding a global lock when doing template
resolution, instead add individual locks on a per cache entry
basis. The global lock is now only used for manipulation of the main
cache data structure.
2012-05-21 14:25:04 -04:00
Tom Clarke
685192bbcb Make the Resolver template cache threadsafe - closes #6404
The Template cache in the Resolver can be accessed by multiple threads
similtaneously in multi-threaded environments. The cache is implemented
using a Hash, which isn't threadsafe in all VMs (notably JRuby).

This commit extracts the cache to a new Cache class and adds mutexes to
prevent concurrent access.
2012-05-21 14:24:30 -04:00
Aaron Patterson
513a0525c2 Merge pull request #2549 from trek/RoutingErrorForMissingControllers
When a route references a missing controller, raise ActionController::RoutingError with clearer message
2012-05-21 11:00:43 -07:00
Andrey Vakarev
ff83df36a4 Refactoring: turn unless/else into if/else 2012-05-21 19:13:24 +03:00
José Valim
74c4e7ba34 Merge pull request #6407 from pinetops/565c1b0a0772ac6cf91c77e9285806f7b028614c
Template concurrency fixes
Conflicts:

	actionpack/lib/action_view/template.rb
2012-05-20 23:40:26 +02:00
Rafael Mendonça França
a78ee05da1 Fix CHANGELOG order and add a brief description of the changes in the
Action Pack in the upgrading guide. [ci skip]
2012-05-20 18:16:03 -03:00
Andrew White
79b38c386a Escape the extension when normalizing the action cache path.
Although no recognized formats use non-ASCII characters, sometimes they
can be included in the :format parameter because of invalid URLS. To
prevent encoding incompatibility errors we need to escape them before
passing the path to URI.unescape.

Closes #4379
2012-05-20 19:07:05 +01:00
Andrew White
3fc561a1f7 Return 400 Bad Request for URL paths with invalid encoding.
Passing path parameters with invalid encoding is likely to trigger errors
further on like `ArgumentError (invalid byte sequence in UTF-8)`. This will
result in a 500 error whereas the better error to return is a 400 error which
allows exception notification libraries to filter it out if they wish.

Closes #4450
2012-05-20 19:07:04 +01:00
Andrew White
66eb3f02cc Raise ActionController::BadRequest for malformed parameter hashes.
Currently Rack raises a TypeError when it encounters a malformed or
ambiguous hash like `foo[]=bar&foo[4]=bar`. Rather than pass this
through to the application this commit captures the exception and
re-raises it using a new ActionController::BadRequest exception.

The new ActionController::BadRequest exception returns a 400 error
instead of the 500 error that would've been returned by the original
TypeError. This allows exception notification libraries to ignore
these errors if so desired.

Closes #3051
2012-05-20 19:07:04 +01:00
Andrew White
972376a995 Correct order of expected and actual arguments 2012-05-20 19:07:04 +01:00
Vijay Dev
ad3f47dc2f fix closing tag [ci skip] 2012-05-20 21:12:25 +05:30
David Chelimsky
dcce01132d Raise Assertion instead of RoutingError for routing assertion failures.
Before this change, assert_recognizes, assert_generates, and
assert_routing raised ActionController::RoutingError when they failed to
recognize the route.

This commit changes them to raise Assertion instead. This aligns with
convention for logical failures, and supports reporting tools that care
about the difference between logical failures and errors e.g. the
summary at the end of a test run.

- Fixes #5899
2012-05-20 06:21:32 -05:00
Dmitry Vorotilin
32a433e1c0 Show in log correct wrapped keys 2012-05-20 09:33:56 +04:00
Piotr Sarnacki
da97cf016a Merge pull request #5631 from avakhov/ac-log-subsriber-small-refac
Make AC::LogSubscriber#send_file like #send_data
2012-05-19 19:02:38 -07:00
Henrik Hodne
fa6d921e11 Remove blank trailing comments
For future reference, this is the regex I used: ^\s*#\s*\n(?!\s*#). Replace
with the first match, and voilà! Note that the regex matches a little bit too
much, so you probably want to `git add -i .` and go through every single diff
to check if it actually should be changed.
2012-05-20 01:29:13 +02:00
Henrik Hodne
7eb09aed87 Update documentation for AbstractController::Base 2012-05-20 00:50:22 +02:00
kennyj
e5e2ba14c3 Don't use assert_block method. It will be deprecated. 2012-05-20 00:14:40 +09:00
Vijay Dev
1551de3c04 Merge branch 'master' of github.com:lifo/docrails 2012-05-19 19:36:48 +05:30
Carlos Antonio da Silva
0e207a499f Clarify grouped_options_for_select method API, add changelog entry
Make the method API more clear by explicitly showing the expected
arguments. This means that the options cannot be passed as second
argument because we are not relying on extract_options! anymore,
you are expected to give a selected key or `nil` if you want to pass
options, as it is the last argument.

Notice that this does not change the current method arguments contract
available in 3.2, it just brings back the same functionality with the
divider addition.
2012-05-19 09:58:14 -03:00
Andrew White
ec77498351 Improve rake routes output for redirects - closes #6369. 2012-05-19 11:22:00 +01:00
Alexey Vakhov
117382f914 Make AC::LogSubscriber#send_file like #send_data 2012-05-19 09:42:36 +04:00
Jeremy Kemper
49b72fa864 Merge pull request #6384 from ihid/tidy_text_helpers
Tidied and standardised text_helper implementations.
2012-05-18 17:15:32 -07:00
Francesco Rodriguez
ec430d478a minor fix wrapper tag documentation 2012-05-18 19:11:50 -05:00
Jeremy Walker
7e82ebd25e Tidied and standardised text_helper implementations. 2012-05-19 00:39:31 +01:00
Łukasz Strzałkowski
5f7bfb7778 Fix inspecting route redirections, closes #6369
This commit fixes route inspection in `rake routes`

Before:

  foo  /foo(.:format) :controller#:action"

After:

  foo  /foo(.:format)  Redirect (301)
2012-05-18 23:55:39 +02:00