Commit Graph

10163 Commits

Author SHA1 Message Date
Carlos Antonio da Silva
9dfe2d6f9f Revert "log at debug level what line caused the redirect_to"
This reverts commit 3fa00070047b5d019d39e691598ee2890283d052.

Reason: This message is usually not accurate and annoying:

    Redirected by ~/.rbenv/versions/1.9.3-p327-perf/lib/ruby/1.9.1/logger.rb:371:in `add'`
2013-01-15 12:47:25 -02:00
Steve Klabnik
1dd89250d1 Merge pull request #8938 from colinbm/date_select_value
Rename :value to :selected for date_select, and add missing tests/docs
2013-01-14 12:18:36 -08:00
Colin Burn-Murdoch
1fecaf15d7 Rename :value option to :selected, in line with other select helpers
Add tests for time & datetime.
Add documentation.
2013-01-14 19:49:07 +00:00
Jeremy Kemper
bf095770e5 Revert benchmark helper regression. Use a #capture within a #benchmark
block. Breaks benchmark calls that return non-String values otherwise.

Revert "add benchmark helper that works in erb"

This reverts commit 904e544cc8f5846de7c31827bb5556c6a238c0de.

Conflicts:
	actionpack/lib/action_view/helpers.rb
	actionpack/lib/action_view/helpers/benchmark_helper.rb
	actionpack/test/template/benchmark_helper_test.rb
2013-01-14 10:24:43 -07:00
Rafael Mendonça França
242f12506d Merge pull request #8916 from josemota/collection-with-block
Collection radio buttons and collection check boxes through FormBuilder render the provided block.

Closes #8897
2013-01-13 18:27:41 -08:00
Colin Burn-Murdoch
aea3820261 Allow value to be set on date_select 2013-01-13 21:03:21 +00:00
Steve Klabnik
a0265b98f1 Associaton -> Association 2013-01-13 10:43:24 -05:00
José Mota
8cc60d8136 Collection radio buttons and collection check boxes through FormBuilder render
the provided block.

In the case of having a form_for method being called, the block for each
collection would not be passed and thus the result expected was always the same.
This patch passes the block to the original method like it would be assumed.
2013-01-12 17:42:18 +00:00
Sam Ruby
c692774bba Fix regression introduced in pull request 8812
See https://github.com/rails/rails/pull/8812#commitcomment-2416514
2013-01-11 16:48:58 -05:00
Carlos Antonio da Silva
d61b49e178 Merge pull request #8882 from goshakkk/clearer-conditional
Clearer conditional in constraint match check
2013-01-11 03:21:51 -08:00
Jon Leighton
94797ed146 Merge pull request #8623 from virusman/form_helpers_collectionproxy_fix
Fixed nested fields bug when called with AssociationProxy
2013-01-11 03:08:41 -08:00
Dylan Smith
bae92681be Fix json params parsing regression for non-object JSON content.
Fixes #8845.
2013-01-11 00:28:32 -05:00
Gosha Arinich
caa54db8a0 clearer conditional in constraint match check 2013-01-10 23:40:57 +03:00
Guillermo Iguaran
416a179ddf Merge pull request #8876 from senny/extract_performance_tests
Extract ActionDispatch::PerformanceTest
2013-01-10 08:10:22 -08:00
Yves Senn
3e1ed7818b extract PerformanceTest into rails-performance_tests gem 2013-01-10 17:09:06 +01:00
Rafael Mendonça França
2b5019e234 Merge pull request #8821 from jamis/master
Evaluate view_cache_dependencies at the instance level

Conflicts:
	actionpack/lib/action_controller/caching.rb
2013-01-10 13:34:40 -02:00
zires
ff8f92b2bf Remove redundant double quotation marks 2013-01-10 10:23:26 +08:00
Aaron Patterson
8ae9b4623e adding missing requires 2013-01-09 15:34:58 -08:00
Nathaniel Jones
d2f1ca29fc Fix typo in deprecation warning 2013-01-09 04:04:57 -06:00
Santiago Pastorino
5d0d82957a Merge pull request #8824 from mjtko/fix/cookie-store-inheritance
Modify CookieStore middleware inheritance to avoid subclassing Rack::Session::Cookie [Fix for #7372]
2013-01-08 17:27:13 -08:00
Carlos Antonio da Silva
b28d6e2c76 Remove :yaml related tests and fix other related to parsing empty arrays
All Action Pack tests are green.
2013-01-08 20:27:48 -02:00
Carlos Antonio da Silva
21879c560f Fix warning: & interpreted as argument prefix 2013-01-08 20:16:20 -02:00
Aaron Patterson
e80546cdec remove yaml as a param parser :burn:
If you revert this commit, I will hunt you down, I will make you regret
ever terrible thing you've ever done, I will make you suffer.
2013-01-08 13:50:38 -08:00
Jeremy Kemper
46e0d2397e CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml. 2013-01-08 12:42:29 -08:00
Aaron Patterson
8e577fe560 * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu
Conflicts:
	actionpack/CHANGELOG.md
	actionpack/lib/action_dispatch/http/request.rb
	actionpack/lib/action_dispatch/middleware/params_parser.rb
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/relation/predicate_builder.rb
	activerecord/test/cases/relation/where_test.rb
2013-01-08 12:41:24 -08:00
Jeremy Kemper
c31cc963da Revert "Merge branch 'master-sec'"
This reverts commit 88cc1688d0cb828c17706b41a8bd27870f2a2beb, reversing
changes made to f049016cd348627bf8db0d72382d7580bf802a79.
2013-01-08 12:41:04 -08:00
Aaron Patterson
88cc1688d0 Merge branch 'master-sec'
* master-sec:
  CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml.
  * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu
2013-01-08 12:11:18 -08:00
Jeremy Kemper
2ced6f2f8a CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml. 2013-01-08 12:03:34 -08:00
Vijay Dev
f049016cd3 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/getting_started.md
2013-01-09 01:04:15 +05:30
Jamis Buck
0121377cfb evaluate the dependency blocks at the instance level, not class level 2013-01-08 12:02:11 -07:00
Jamis Buck
70e684a681 view_cache_dependency API
A declarative API for specifying dependencies that affect template
cache digest computation. In your controller, specify any of said
dependencies:

  view_cache_dependency { "phone" if using_phone? }

When the block is evaluated, the resulting value is included in the
cache digest calculation, allowing you to generate different digests
for effectively the same template. (Mostly useful if you're mucking
with template load paths.)
2013-01-08 11:20:47 -07:00
Steve Klabnik
ac86cbec82 Merge pull request #8810 from NARKOZ/image-submit-tag
set 'alt' attribute for image_submit_tag
2013-01-08 07:39:06 -08:00
David Heinemeier Hansson
cc1c3c5be0 Revert "unpermitted params" exception -- it's just not going to work. See the discussion on https://github.com/rails/strong_parameters/pull/75. 2013-01-08 16:17:30 +01:00
David Heinemeier Hansson
ae3286b743 Never treat action or controller as unpermitted params 2013-01-08 15:52:18 +01:00
Carlos Antonio da Silva
4f002a1df3 Bump rack dependency to 1.4.3
It includes security bug fixes and changes the initialization of
Rack::File to accept a hash, otherwise generating warnings.

See 295806e for the warnings fix.
2013-01-08 10:49:02 -02:00
Sam Ruby
9cc82b7719 Eliminate Rack::File headers deprecation warning
See http://intertwingly.net/projects/AWDwR4/checkdepot/section-6.1.html
rake test produces:
   "Rack::File headers parameter replaces cache_control after Rack 1.5."

Despite what the message says, it appears that the hearders parameter change
will be effective as of Rack 1.5:

https://github.com/rack/rack/blob/rack-1.4/lib/rack/file.rb#L24
https://github.com/rack/rack/blob/master/lib/rack/file.rb#L24
2013-01-08 07:22:48 -05:00
Nihad Abbasov
0f8f75c81a set 'alt' attribute for image_submit_tag 2013-01-08 15:56:47 +04:00
Carlos Antonio da Silva
c67005f221 Do not generate local vars for partials without object or collection
Previously rendering a partial without giving :object or :collection
would generate a local variable with the partial name by default.

This was noticed due to warnings in Ruby 2.0 of not used variables,
which turned out to be the generation of not used variables inside
partials that do not contain objects related to them.
2013-01-08 09:15:20 -02:00
Mark J. Titorenko
109a1b3358 Revert cb3181e - no longer required. 2013-01-08 10:10:39 +00:00
Mark J. Titorenko
fc66b6b004 Fix CookieStore middleware inheritance hierarchy s.t. it inherits from Rack::Session::Abstract::ID rather than Rack::Session::Cookie. 2013-01-08 10:10:36 +00:00
Santiago Pastorino
cb3181e81e Avoid Rack security warning no secret provided
This avoids "SECURITY WARNING: No secret option provided to Rack::Session::Cookie."
2013-01-08 00:33:16 -02:00
Aaron Patterson
d99e8c9e16 * Strip nils from collections on JSON and XML posts. [CVE-2013-0155] * dealing with empty hashes. Thanks Damien Mathieu
Conflicts:
	actionpack/CHANGELOG.md
	actionpack/lib/action_dispatch/http/request.rb
	actionpack/lib/action_dispatch/middleware/params_parser.rb
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/relation/predicate_builder.rb
	activerecord/test/cases/relation/where_test.rb
2013-01-07 17:20:12 -08:00
Francesco Rodriguez
2aa08e313d improve StrongParameters documentation [ci skip] 2013-01-07 16:18:06 -05:00
Gosha Arinich
ae1f86fab5 access @path and @routes via reader methods in journey 2013-01-07 17:37:02 +03:00
Gosha Arinich
a7f9c596b3 refactor ShowExceptions' #call to use def-rescue instead of begin-rescue 2013-01-07 15:58:55 +03:00
Gosha Arinich
0acf92184d prefer american spelling of 'behavior' 2013-01-07 11:47:27 +03:00
Gosha Arinich
d73cc03010 remove begin-rescue in favor of def-rescue 2013-01-07 04:02:20 +03:00
Rafael Mendonça França
cc24eba544 Fix operators precedence issue 2013-01-06 21:54:46 -03:00
Rafael Mendonça França
dc4b4c46ef Merge pull request #8787 from tank-bohr/master
masgn and response variable
2013-01-06 16:00:14 -08:00
Rafael Mendonça França
fb7c093d93 Merge pull request #8785 from goshakkk/refactor-debug-exceptions
Refactor DebugExceptions
2013-01-06 15:49:33 -08:00
Gosha Arinich
c445b07612 refactor DebugExceptions by combining two conditionals into one 2013-01-07 02:46:03 +03:00
tank-bohr
f3101fd0fc return multiple assingment and response variable 2013-01-07 03:37:06 +04:00
Akira Matsuda
3c21237c37 Reduce number of Strings a bit 2013-01-07 07:37:23 +09:00
Akira Matsuda
c8e632bd9f Namespace HashWithIndifferentAccess 2013-01-07 07:37:23 +09:00
Rafael Mendonça França
4bfcae0b67 Merge pull request #8783 from goshakkk/refactor-journey-routes
Refactor Journey::Routes
2013-01-06 14:30:35 -08:00
Gosha Arinich
2467ec8b5c refactor Journey::Routes
* prefer do-end for multiline blocks
* prefer or-equals over returns with checks
2013-01-07 01:24:29 +03:00
tank-bohr
8f18550b0a fix for rbx
Rubinius returns a boolean after such assingment
response = (_, headers, body = @app.call(env))

see https://github.com/rubinius/rubinius/issues/2117

get rid of a local variable
2013-01-07 02:00:40 +04:00
Akira Matsuda
2f8e5f627d Needless requires 2013-01-06 23:59:11 +09:00
Akira Matsuda
5fd143ec56 Missing requires 2013-01-06 23:58:48 +09:00
Akira Matsuda
15bd0f60db These are already required through AS/rails
* core_ext/object/blank
* concern
* core_ext/class/attribute
* deprecation
2013-01-06 23:57:25 +09:00
Carlos Antonio da Silva
b8d9319e8e Rename route_wrapper partial layout to table
It is used by the table formatter only, and it's already inside a routes
directory that namespaces it properly, so calling it just "table" seems
simpler.
2013-01-06 11:22:26 -02:00
Carlos Antonio da Silva
3abb76824b Move table routes formatter class to the inspector and rename it
It feels more consistent to have this class called "HtmlTableFormatter",
and to have it here with the routes inspector and console formatter,
since it's used for both routing error exceptions and the rails info
page.
2013-01-06 11:19:30 -02:00
Andrew White
f18078475e Merge pull request #8777 from goshakkk/delegate-class
Delegate to :class rather than 'self.class'
2013-01-06 05:00:54 -08:00
Carlos Antonio da Silva
7843e009d2 Refactor the logic that checks whether or not to emit the hidden id field
By checking for object.persisted? first, we avoid the hash lookups for
new objects.
2013-01-06 10:54:22 -02:00
Carlos Antonio da Silva
e56e3db6e6 Move the hidden :id field logic to where it belongs to
When dealing with nested forms, Rails automatically generates a hidden
field with the id value of the current object being generated by
fields_for. This logic was inside the method that's available from the
template object, but we just need it when really dealing with nested
attributes, so moving the code to here makes more sense.
2013-01-06 10:54:22 -02:00
Carlos Antonio da Silva
04338b9e3b Eliminate the usage of parent_builder option from form_for
Just use it internally from fields_for until we come up with a better solution.
2013-01-06 10:54:22 -02:00
Carlos Antonio da Silva
115a37d9c1 Do not call fields_for from form_for, to avoid instantiating two builders 2013-01-06 10:54:21 -02:00
Carlos Antonio da Silva
94ecbb7e7b Refactor to not call path.ast twice 2013-01-06 10:52:36 -02:00
Gosha Arinich
c730bef3d8 refactor Route#ast to use or-equals and block, instead of return with a cond 2013-01-06 15:38:00 +03:00
Gosha Arinich
7a439d23de delegate to :class rather than 'self.class' 2013-01-06 12:43:30 +03:00
Akira Matsuda
70ae89c321 Remove unnecessary begin..rescue..end, use only rescue 2013-01-06 15:41:14 +09:00
Chase DuBois
0836b7441e HTTP 302 means Found, not Moved 2013-01-05 13:03:26 -08:00
Rafael Mendonça França
688dde2d62 Fix documentation to content_tag_for [ci skip] 2013-01-05 16:50:15 -03:00
Andrew White
fa6e995a03 Merge pull request #8766 from jcoglan/session_token_docs
Remove suggestion that Procs can be used as session secrets.

[ci skip]
2013-01-05 10:30:30 -08:00
Yves Senn
947e1d5e85 deprecate assert_blank and assert_present.
They don't add any benefits over `assert object.blank?`
and `assert object.present?`
2013-01-05 18:04:52 +01:00
Carlos Antonio da Silva
0aadca2d83 Remove warning, remove not used variable, and make methods private
Warning: "shadowing outer local variable - routes".
2013-01-05 13:45:44 -02:00
James Coglan
6500d7994e Remove suggestion that Procs can be used as session secrets. 2013-01-05 15:16:18 +00:00
Carlos Antonio da Silva
c1eaff00b7 Close container div tag in routing error page 2013-01-05 12:02:18 -02:00
Carlos Antonio da Silva
60e809cffd Move style to head to make routes page valid html5 2013-01-05 12:01:16 -02:00
Carlos Antonio da Silva
6cc42464fe Action Pack changelog improvements [ci skip] 2013-01-05 11:42:23 -02:00
Yves Senn
80795e02ca display mountable engine routes on RoutingError. 2013-01-05 14:31:03 +01:00
Yves Senn
af5c0fd85f split formatting concerns from RoutesInspector 2013-01-05 13:59:14 +01:00
Rafael Mendonça França
0102c817bf Rename the last occurrence of UnexpectedParameters 2013-01-05 07:04:42 -03:00
Rafael Mendonça França
18ac587cd8 Wrong copy and paste 💣
[ci skip]
2013-01-05 07:01:51 -03:00
Rafael Mendonça França
beda9c5bdf Add documentation to raise_on_unpermitted_parameters option
[ci skip]
2013-01-05 06:56:24 -03:00
Rafael Mendonça França
1401f96492 Rename the configuration to raise_on_unpermitted_parameters
Also changed the exception to UnpermittedParameters
2013-01-05 06:39:51 -03:00
Rafael Mendonça França
58f52677e8 Ensure that raise_on_unexpected_params configuration will work 2013-01-05 06:23:28 -03:00
Rafael Mendonça França
df1f290712 Merge pull request #8752 from thomasfedb/master
Exception on unexpected params when enabled.
2013-01-05 00:22:06 -08:00
Thomas Drake-Brockman
08578bb40a Allow developers to enable raising of exception when unexpected params are provided. 2013-01-05 15:46:38 +08:00
Andrew White
add4375a60 Allow use of durations for ActionDispatch::SSL configuration 2013-01-04 16:20:23 +00:00
Ryunosuke SATO
fbb3e8ec13 Remove unnecessary ERB::Util::h
It is automatically applied when strings is unsafe for html.
2013-01-05 00:50:06 +09:00
Ryunosuke SATO
0f103679eb Suppress warning about IO#lines in Ruby 2.0
actionpack/lib/action_dispatch/middleware/exception_wrapper.rb:99: IO#lines is deprecated; use #each_line instead
2013-01-04 23:30:09 +09:00
Guillermo Iguaran
7019858fcc Merge pull request #8723 from goshakkk/refactor-error-page
Move error page js into script tag
2013-01-03 22:50:07 -08:00
Francesco Rodriguez
654f0d6a15 extract alert= and notice= examples to FlashHash#now [ci skip] 2013-01-03 20:28:33 -05:00
Akira Matsuda
034982ef22 Revert "TODO typo fix"
This reverts commit 1a59a6dfdca217e31a52779d92aa56b67c6689cb.

I guess it's not a typo: https://github.com/jorlhuda/exceptron
2013-01-04 09:06:40 +09:00
Gosha Arinich
1a59a6dfdc TODO typo fix 2013-01-04 02:57:56 +03:00
lambda_
ebdb8633bf Add examples alert= and notice=, using memes 2013-01-03 17:40:02 -05:00
lambda_
8370e50d85 Change Example for to Example of 2013-01-03 17:33:00 -05:00
Rafael Mendonça França
3be2edd5f7 Add documentation to ActionDispatch::Http::UploadedFile#headers
[ci skip]
2013-01-03 18:49:28 -03:00
Gosha Arinich
1a5b5e19fc move error page js into script tag 2013-01-04 00:14:07 +03:00
Robin Dupret
4075be80a2 Remove a useless TODO comment 2013-01-03 19:50:43 +01:00
Guillermo Iguaran
cb2bd4aa61 Merge pull request #8705 from amparo-luna/change_update_attributes_to_update
Rename update_attributes method to update
2013-01-03 09:09:59 -08:00
Amparo Luna + Guillermo Iguaran
1bb020063c Change docs to use update instead of update_attributes 2013-01-03 12:03:34 -05:00
Matt Bridges
f6364e454a Typo and grammar fixes in the ActionPack CHANGELOG 2013-01-03 10:30:11 -06:00
Guillermo Iguaran
f8633f9fdd Merge pull request #8713 from goshakkk/better-error-page
Fix env toggling, improve error page styling
2013-01-03 06:24:56 -08:00
Gosha Arinich
d7d45785e5 fix env toggling, improve error page styling 2013-01-03 17:21:35 +03:00
Akira Matsuda
79255fab89 PUT => PATCH 2013-01-03 22:34:11 +09:00
Paulo Luis Franchini Casaretto
eab2b999ed Fix typo on form_tag_helper.rb
The inline documentantion had a typo that was somewhat confusing.
2013-01-03 11:07:20 -02:00
Carlos Antonio da Silva
e0be37ccdb Merge pull request #8715 from goshakkk/refactor-mapper
Refactor Routing::Mapper#matches?
2013-01-03 04:07:31 -08:00
Gosha Arinich
77f2ba9559 refactor Routing::Mapper 2013-01-03 13:06:42 +03:00
Andre Arko
cc5a4bb4df Explain the possible precautions 2013-01-02 15:34:27 -08:00
Andre Arko
75dcdbc84e Restore original remote_ip algorithm.
Proxy servers add X-Forwarded-For headers, resulting in a list of IPs. We
remove trusted IP values, and then take the last given value, assuming that
it is the most likely to be the correct, unfaked value. See [1] for a very
thorough discussion of why that is the best option we have at the moment.

[1]: http://blog.gingerlime.com/2012/rails-ip-spoofing-vulnerabilities-and-protection/

Fixes #7979
2013-01-02 15:26:27 -08:00
Carlos Antonio da Silva
9f200fb296 Changelog improvements [ci skip] 2013-01-02 21:11:11 -02:00
Rafael Mendonça França
ef61504c6e Merge pull request #8697 from goshakkk/undup
Remove another unnecessary dup
2013-01-02 13:58:32 -08:00
Rafael Mendonça França
8af674714c Merge pull request #8701 from senny/8700_double_slash_with_trailing_slash
do not append a second slash when using `trailing_slash: true`
2013-01-02 13:39:56 -08:00
Guillermo Iguaran
c9f0680cdf Fixing closing </p> 2013-01-02 16:18:17 -05:00
Sam Ruby
73f4f4aa8f Fix a number of validation/style errors:
* <pre> is not allowed to be nested inside of <p> elements in HTML
 * Indentation of </p> doesn't match corresponding <p>
 * <p> element not explicitly closed
 * One more </div> than <div>

In each case, the template was fixed to match how a HTML5 parser would "see"
the resulting page.
2013-01-02 16:06:54 -05:00
Yves Senn
0b2ce7d955 do not append a second slash when using 2013-01-02 21:11:16 +01:00
Aaron Patterson
8890fb8087 take into account multipart when calculating tag attributes 2013-01-02 11:52:23 -08:00
Aaron Patterson
497c4bbd47 ask the form builder for form tag attributes 2013-01-02 11:19:42 -08:00
Aaron Patterson
b934034820 do not mutate the options hash (when we do not need to) 2013-01-02 11:14:14 -08:00
Gosha Arinich
8ef780c3e2 remove another unnecessary dup 2013-01-02 19:29:50 +03:00
Carlos Antonio da Silva
bdaafae550 Merge pull request #8694 from goshakkk/undup
Remove unnecessary #dup
2013-01-02 07:48:03 -08:00
Guillermo Iguaran
6e475a04bd Merge pull request #8688 from goshakkk/error-page-toggle
Allow toggling dumps on error page
2013-01-02 07:35:53 -08:00
Gosha Arinich
aca0c6d315 remove unnecessary #dup 2013-01-02 18:33:52 +03:00
Lucas Mazza
ed8122c1d1 Cleanup some unnecessary CSS on the new error page and reformat some lines. 2013-01-02 12:59:02 -02:00
Rafael Mendonça França
fb61a80eae Merge pull request #8689 from goshakkk/error-page
Add source code left padding on error pages
2013-01-02 06:15:15 -08:00
Gosha Arinich
30f86ea24a add source line padding 2013-01-02 17:03:57 +03:00
Gosha Arinich
bb932d5e98 allow toggling dumps instead of just showing 2013-01-02 16:12:51 +03:00
Rafael Mendonça França
6a38befd51 No need to pass a empty block to content_tag_for anymore 2013-01-02 09:53:51 -03:00
Rafael Mendonça França
7e2ef18b51 Make content_tag_for work without block
This is version of #8640 for master
2013-01-02 09:17:54 -03:00
Akira Matsuda
7bc224dda0 remove meaningless AS::FrozenObjectError 2013-01-02 10:04:58 +09:00
Akira Matsuda
f817bb2c48 s/ERb/ERB/ 2013-01-02 06:52:15 +09:00
Akira Matsuda
6c7699f601 PUT => PATCH or PUT 2013-01-02 06:41:51 +09:00
Akira Matsuda
2565c81862 find_or_create_by is deprecated in AR 4 2013-01-02 05:12:16 +09:00
Akira Matsuda
b2e353980e Model.scoped is deprecated in favour of Model.all 2013-01-02 04:08:14 +09:00
Guillermo Iguaran
c113a2f0f6 Add CHANGELOG entry for changes in exception pages 2013-01-01 13:29:04 -05:00
Guillermo Iguaran
c684125833 Fix indent in UnknownAction template 2013-01-01 11:57:22 -05:00
David Heinemeier Hansson
8d945f4f97 Merge pull request #8668 from guilleiguaran/exceptions
New exceptions pages for development
2013-01-01 02:14:23 -08:00
Guillermo Iguaran
25c8770a6c formatted_code_for should be private 2012-12-31 18:07:21 -05:00
Guillermo Iguaran
8ecaf133f3 Summary and Details HTML elements aren't supported in all modern browsers 2012-12-31 17:49:05 -05:00
Guillermo Iguaran
a27c4f6095 Fix test for DebugExceptions due to template change 2012-12-31 16:48:10 -05:00
Guillermo Iguaran
5a1b885dd6 Add style to AV::Template::Error exception page 2012-12-31 16:46:37 -05:00
Andrew Nesbitt
d814284506 Updated copyright notices for 2013 2012-12-31 20:35:29 +00:00
Guillermo Iguaran
9b79bb469b Improve line-height to have better line spacing in exception message 2012-12-31 14:41:04 -05:00
Guillermo Iguaran
78a0d86b0a Add new style to Routing Error page 2012-12-31 14:41:04 -05:00
Guillermo Iguaran
048cd254e6 Styling for exception page 2012-12-31 14:40:59 -05:00
Guillermo Iguaran
fe12e46508 Add source extract to detailed exception page 2012-12-31 13:48:00 -05:00
Rafael Mendonça França
dc8091b88f Use ActiveSupport::TestCase in the journey tests 2012-12-31 14:40:43 -03:00
Santiago Pastorino
cf2dcf4e9f Merge pull request #8666 from mekishizufu/fix_lambdas
Fix usage of lambda as a Rack endpoint
2012-12-31 09:09:11 -08:00
Rafael Mendonça França
5294ad82c6 Alias refute methods to assert_not and perfer assert_not on tests 2012-12-31 13:58:52 -03:00
Rafael Mendonça França
6c0013f7cd Do not use the same tests description 2012-12-31 13:57:24 -03:00
Rafael Mendonça França
d4c94accf7 Remove unneeded tests
These tests are needed only if we are using MiniTest::Spec
2012-12-31 13:57:24 -03:00
Rafael Mendonça França
5da4d5142a Add active_support/testing/autorun
minitest/autorun load minitest/spec polluting the global namespace with
the DSL that we don't want on Rails
2012-12-31 13:57:24 -03:00
Rafael Mendonça França
eb4930e3c7 Inherit from MiniTest::Unit::TestCase instead of MiniTest::Spec 2012-12-31 13:57:23 -03:00
Jiri Pospisil
dbacb95a21 Fix usage of lambda as a Rack endpoint
The response body needs to respond_to? :each.
2012-12-31 17:46:19 +01:00
Santiago Pastorino
5e5107430b Merge pull request #8662 from senny/8661_should_not_append_charset_if_already_present
Charset should not be appended to image/* type
2012-12-31 07:23:36 -08:00
Yves Senn
b8c2f3c769 charset should not be appended for head responses
1) Failure:
    test_head_created_with_image_png_content_type(RenderTest) [test/controller/render_test.rb:1238]:
    Expected: "image/png"
      Actual: "image/png; charset=utf-8"
2012-12-31 16:08:36 +01:00
Santiago Pastorino
2b773e148b Define [], []=, permanent, signed and encrypted as the only allowed methods for the non Raw Cookie classes 2012-12-30 23:50:26 -02:00
Santiago Pastorino
5e80b2530a Merge pull request #8546 from hsbt/fix-testcase-strict-warning
fix testcase: ruby-2.0.0 warned unused variables
2012-12-30 16:07:23 -08:00
Rafael Mendonça França
2283a1d62e Merge pull request #8627 from schneems/schneems/routes-1-9
Ruby 1.9 style hash in Route Inspector
2012-12-26 21:25:28 -08:00
schneems
d5277b8c4e Ruby 1.9 style hash in Route Inspector 2012-12-27 00:12:55 -05:00
Rafael Mendonça França
42d9b48012 Extract the component rendering of collection_radio_buttons and
collection_check_boxes to a private method.

It will make easier to extend.

Example:

    class CollectionRadioButtons < ActionView::Helpers::Tags::CollectionRadioButtons
      include CollectionExtensions

      def render
        wrap_rendered_collection(super, @options)
      end

      private

        def render_component(builder)
          builder.radio_button + builder.label(:class => "collection_radio_buttons")
        end
    end
2012-12-26 23:30:38 -03:00
Rafael Mendonça França
ceedec7edc Fix collection_radio_buttons with the option :checked with value of
`false`
2012-12-26 23:00:31 -03:00
Santiago Pastorino
14a61bba4d Merge pull request #8598 from NARKOZ/refactor-highlight
refactor highlight method: return fast if text or phrases are blank
2012-12-26 14:06:13 -08:00
virusman
c009e86fe1 Test nested fields with AssociationProxy mockup & fix AssociationProxy support in form helper 2012-12-27 00:37:35 +04:00
Rafael Mendonça França
5d80da812b Fix CHANGELOG style [ci skip] 2012-12-26 12:19:09 -03:00
Rafael Mendonça França
84d38f6033 We need to check explictly that env['action_dispatch.show_exceptions']
is false.

If it is nil we can't raise the exception
2012-12-26 12:15:18 -03:00
Hrvoje Šimić
7731fd86b1 more descriptive return parameters 2012-12-26 14:17:11 +01:00
Nihad Abbasov
513331d114 fetch highlighter option only when needed 2012-12-24 20:56:32 +04:00
Akira Matsuda
e8cf06e1d4 "warning: ambiguous first argument; put parentheses or even spaces" 2012-12-24 13:04:08 +09:00
Akira Matsuda
a2ce1de14e we're not supporting SQLite 2 2012-12-24 12:23:39 +09:00
Guillermo Iguaran
cba05887dc Merge pull request #8085 from acapilleri/format_never_nil
if format is unknown NullMimeTypeObject is returned
2012-12-22 00:38:56 -08:00
Angelo Capilleri
c2267db383 return Mime::NullType if format is unknown
If a request has an unknown format, the methods html?, xml?, json? ...etc
not raise an Exception.

This patch add a class Mime::NullType, that is returned when  request.format is unknown
and it responds false to the methods that ends with '?' and true to 'nil?'.

It refers to #7837, this issue is considered a improvement not a bug.
2012-12-22 09:18:08 +01:00
Rafael Mendonça França
8a39d83311 Merge pull request #8586 from balexand/cache_digests_regex
Digestor explicit dependency should not contain trailing whitespace
2012-12-21 23:52:44 -08:00
Brian Alexander
749a745264 Digestor explicit dependency should not contain trailing whitespace
test for rails/rails#8586
2012-12-21 18:00:51 -07:00
Jeremy Kemper
f9da785d0b Move background jobs to the 'jobs' branch until fully baked. Not shipping with Rails 4.0. 2012-12-21 16:29:47 -08:00
Steve Klabnik
625699aa6c Merge pull request #7312 from krainboltgreene/http-token-parser-bug
Http token parser bug
2012-12-21 15:25:10 -08:00
Vijay Dev
e0176bf732 Merge branch 'master' of github.com:lifo/docrails 2012-12-21 23:14:08 +05:30
Vijay Dev
6fee8f3ce6 Revert "Fix incorrect adjustment 4c41e87e3ae548c44810b66437b2f0f6e73b2106"
This reverts commit e1f8ec59f2cc83f052b15233147aa2d6d8114a4d.

Reason: seems bad styling

[ci skip]
2012-12-21 23:03:52 +05:30
Carlos Antonio da Silva
9e7bcaa9b3 Fix indentation issuing warning 2012-12-20 20:19:36 -02:00
Rafael Mendonça França
3aa327f988 Merge pull request #8567 from frodsan/update_coding_conventions_journey
update AD::Journey to follow Rails coding conventions
2012-12-20 12:45:09 -08:00
Francesco Rodriguez
eb493f5ac8 update AD::Journey to follow Rails coding conventions 2012-12-20 15:42:39 -05:00
kei
e1f8ec59f2 Fix incorrect adjustment 4c41e87e3ae548c44810b66437b2f0f6e73b2106 2012-12-20 18:24:31 +09:00
Guillermo Iguaran
a8ad694a86 Fix CHANGELOG entry about scope change
I missed attribution on this 😳
2012-12-20 04:21:34 -05:00
kei
4c41e87e3a Fix documentation style 2012-12-20 18:10:21 +09:00
SHIBATA Hiroshi
4f0f1b5d52 change spy of after invoked controller action. because ruby-2.0.0 waned unused variables 2012-12-20 17:14:22 +09:00
Francesco Rodriguez
a36ae63d07 :nodoc: Journey because is not part of the public API [ci skip] 2012-12-19 19:24:25 -05:00
Francesco Rodriguez
a1cffa6d58 remove code for Ruby 1.8.x support 2012-12-19 17:52:50 -05:00
Andrew White
f0129da385 Remove the actual extension file as well [ci skip] 2012-12-19 22:32:59 +00:00
Andrew White
dc0542f809 Remove obsolete Hash extension needed for Ruby 1.8.x support
[ci skip]
2012-12-19 22:28:43 +00:00
Andrew White
56fee39c39 Integrate Journey into Action Dispatch
Move the Journey code underneath the ActionDispatch namespace so
that we don't pollute the global namespace with names that may
be used for models.

Fixes rails/journey#49.
2012-12-19 22:13:08 +00:00
Carlos Antonio da Silva
939ff86139 Move changelog entry to the top [ci skip] 2012-12-19 13:22:03 -02:00
Nick Reed
cf9d9450ec Remove obfuscation support from mail_to helper
Removes support for :encode, :replace_at, and :replace_dot
options from the mail_to helper. Support for these options
has been extracted to the 'actionview-encoded_mail_to' gem.
2012-12-18 22:39:12 -06:00
Carlos Antonio da Silva
c3e573db54 Minor js review [ci skip]
Remove/add ; where necessary, fix indentation.
2012-12-18 08:28:21 -02:00
Vasiliy Ermolovich
0a6d8fbe17 handle protocol option in stylesheet_link_tag and javascript_include_tag
closes #8388
2012-12-18 11:16:17 +03:00
schneems
37d9c44b6d Format routes as html on debug page
When someone gets a routing exception, the routes are rendered (starting in Rails 4.0). This PR brings parity between the html routes in the `rails/info/routes` path and when rendered from an exception. This is the continuation of #8521 which brought html formatted routes. 

In addition to bringing parity to the two views, we're keeping our views DRY by rendering off of the same partials. In this case Railties depends on partials provided by ActionDispatch. I'm open to alternative implementations. Ideally both views will use the same code so any improvements or updates to it will be reproduced on both.

<hr />

![](http://f.cl.ly/items/3O1D0K1v0j0i343O3T3T/Screen%20Shot%202012-12-17%20at%203.07.20%20PM.png)
2012-12-17 15:59:15 -06:00
Andrew White
dcb318ee43 Make conditional_layout? private and update documentation
The conditional_layout? method is not for public use and doesn't
actually do what the documentation suggested it does. It's actually
used to determine whether or not to use the explicit layout definition
defined in a controller or use the implicit layout definition.

Also documentation was added for the action_has_layout? method which
acts as a master switch for disabling the layout for the current
action. This method was added so that action caching didn't depend
on accessing layout internals but is also used by third-parties,
most notably the [Hobo][1] application.

[1]: https://github.com/hobo/hobo
2012-12-17 16:29:38 +00:00
Ivan Vanyak
0c181b4b70 Add script_name option description and example for #url_for options 2012-12-17 14:15:01 +11:00
Steve Klabnik
aefdcfdf3d Merge pull request #8529 from schneems/schneems/debug-exceptions-extend-path
DebugExceptions `File.join` => `File.expand_path`
2012-12-16 12:24:20 -08:00
schneems
170a93d25c DebugExceptions File.join => File.expand_path 2012-12-16 12:34:34 -06:00
Kurtis Rainbolt-Greene
f71cca9e10 Refactoring the token_and_options method to fix bugs
Adding a test for the equal trun bug

Adding a test for the after equal trunc bug

Adding a test for the slash bug

Adding a test for the slash quote bug

Adding a helper method for creating a sample request object with token

Writing a method to create params array from raw params

Writing a method to rewrite param values in the params

Writing a method to get the token params from an authorization value

Refactoring the token_and_options method to fix bugs

Removing unnessecary test

A constant for this shared regex seemed appropriate

Wanting to split up this logic

Adding small documentation pieces
2012-12-15 15:56:42 -08:00
Vijay Dev
5cc178a291 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	actionpack/lib/action_view/helpers/form_helper.rb
	railties/lib/rails/info_controller.rb
2012-12-15 21:20:28 +05:30
Carlos Antonio da Silva
df9f9b7f3e Convert changelogs to 1.9 hash style and fix some formatting [ci skip] 2012-12-14 20:25:22 -02:00
Steve Klabnik
8554537e48 Revert "Merge pull request #8499 from schneems/schneems/html-route-inspector"
This reverts commit ae68fc3864e99ab43c18fd12577744e1583f6b64, reversing
changes made to 0262a18c7b0ab6f60fee842b3007388f9ffeb0fa.

See here: https://github.com/rails/rails/pull/8499#issuecomment-11356417
2012-12-14 15:44:57 -05:00
Aaron Patterson
fa3457dc3b remove a cache we do not need 2012-12-14 11:16:18 -08:00
Aaron Patterson
49219293e5 Merge pull request #8510 from thedarkone/thread_safety_improvements
Thread safety improvements
2012-12-14 11:12:50 -08:00
Rafael Mendonça França
05e9075541 Improve the documentation of cache_if and cache_unless 2012-12-14 15:17:23 -03:00
Rafael Mendonça França
414b1c3da6 Merge pull request #8497 from acapilleri/conditional_cache
Removed :if / :unless conditions to fragment cache in favour of *cache_i...
2012-12-14 13:57:53 -03:00
Angelo capilleri
83223424b3 Removed :if and :unless from fragment cache option in favour of
cache_if(condition, option, &block) and cache_unless(condition, option, &block).

In the PR #8371 was introduced  conditional options :if and :unless in
the cache method.

    Example:

      <%= cache @model, if: some_condition(@model) do %>
        ...
      <%end%>

This is a good feature but *cache_if* and and *cache_unless*
are more concise and close to the standard of rails view helpers
(ex: link_to_if and link_to_unless).

    Example:

      <%= cache_if condition, @model do %>
      ...
      <%end%>
2012-12-14 17:51:52 +01:00
Andrew White
01d3a36bfe Clear url helper methods when routes are reloaded
Remove all the old url helper methods when clear! is called on the
route set because it's possible that some routes have been removed.
2012-12-14 13:22:36 +00:00
Andrew White
a16da3f25f Revert "Clear url helpers when reloading routes"
This doesn't actually remove old url helper methods as they are
defined in a different module.

This reverts commit 96bcef947bf713b7d9fc88f26dff69f568111262.

Conflicts:
	actionpack/CHANGELOG.md
2012-12-14 13:19:50 +00:00
thedarkone
45448a5788 Replace some global Hash usages with the new thread safe cache.
Summary of the changes:
 * Add thread_safe gem.
 * Use thread safe cache for digestor caching.
 * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation.
 * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache.
 * Use TS::Cache to avoid the synchronisation overhead on listener retrieval.
 * Replace synchronisation with TS::Cache usage.
 * Use a preallocated array for performance/memory reasons.
 * Update the controllers cache to the new AS::Dependencies::ClassCache API.
   The original @controllers cache no longer makes much sense after @tenderlove's
   changes in 7b6bfe84f3 and f345e2380c.
 * Use TS::Cache in the connection pool to avoid locking overhead.
 * Use TS::Cache in ConnectionHandler.
2012-12-14 12:18:47 +01:00
Rafael Mendonça França
5d54fd77b8 Add missing require.
I was trying to use those files without Rails and that require was
missing.
2012-12-13 14:49:58 -03:00
Steve Klabnik
ae68fc3864 Merge pull request #8499 from schneems/schneems/html-route-inspector
Output routes in :html format
2012-12-13 08:30:51 -08:00
Carlos Antonio da Silva
0262a18c7b Bring back helpers_path attr accessor
This is apparently used by the railtie to setup the app helpers paths
correctly between initializers. I'll need to check it further.
2012-12-13 09:41:09 -02:00
Carlos Antonio da Silva
cff0e51ae9 Refactor helpers code in Action Pack a bit
* Avoid calling class_eval when not needed
* Remove helpers_path attr accessor, it's defined as a class attribute a
  few lines later
* Avoid creating extra arrays when finding helpers, use flat_map and sort!
* Remove not required refer variable when redirecting :back
2012-12-13 08:46:12 -02:00
schneems
08d7b186fd Output routes in :html format
By formatting routes for different media (txt/html) we can apply optimizations based on the format. We can include meta-data in the HTML to allow a rich experience while rendering and viewing the routes. This PR shows route helpers as they are used with the `_path` extension, it also has a javascript toggle on the top to switch to `_url`. This way the developer can see the exact named route helper they can use instead of having to modify a base. 

This is one example of an optimization that could be applied. Eventually we can link out to guides for the different columns to better explain what helper, HTTP Verb, Path, and Controller#action indicate. We could even add a route search box that could allow developers to input a given route and see all of the routes that match it. These are stand alone features and should be delivered separately.
2012-12-12 14:21:02 -06:00
Carlos Antonio da Silva
d4333eded2 Remove deprecation message from Action Pack
Related to the deprecation of Time.utc_time in favor of Time.utc,
in 48583f8bf74d1cefefea3cd6591bd546a9eaff6c.
2012-12-11 23:58:20 -02:00
Carlos Antonio da Silva
2125a6a27f Remove not used variable warnings from AM and AC 2012-12-11 23:57:56 -02:00
Matt Venables
991601ff6e Fix rewinding in ActionDispatch::Request#raw_post
If env['RAW_POST_DATA'] is nil, #raw_post will attempt to set it to
the result of #body (which will return env['rack.input'] if
env['RAW_POST_DATA'] is nil). #raw_post will then attempt to rewind
the result of another call to #body. Since env['RAW_POST_DATA'] has
already been set, the result of #body is not env['rack.input'] anymore.
This causes env['rack.input'] to never be rewound.
2012-12-11 16:57:21 -05:00
Hiro Asari
c00e7aa919 Match the controller and path names defensively.
Use '\A' instead of '^', and make the alteration shorter.
2012-12-10 23:04:51 -05:00
Santiago Pastorino
603e7f7ea5 Merge pull request #8468 from schneems/schneems/rack-index-page
Use Rails to Render Default Index Page
2012-12-10 19:49:10 -08:00
schneems
baea5d69be Use Rails to Render Default Index Page
This is an alternative implementation to #7771 thanks to the advice of @spastorino

Rails is a dynamic framework that serves a static index.html by default. One of my first questions ever on IRC was solved by simply deleting my public/index.html file. This file is a source of confusion when starting as it over-rides any set "root" in the routes yet it itself is not listed in the routes. By making the page dynamic by default we can eliminate this confusion.

This PR moves the static index page to an internal controller/route/view similar to `rails/info`. When someone starts a rails server, if no root is defined, this route will take over and the "dynamic" index page from rails/welcome_controller will be rendered. These routes are only added in development. If a developer defines a root in their routes, it automatically takes precedence over this route and will be rendered, with no deleting of files required. 

In addition to removing this source of confusion for new devs, we can now use Rails view helpers to build and render this page. While not the primary intent, the added value of "dogfooding" should not be under-estimated.

The prior PR #7771 had push-back since it introduced developer facing files. This PR solves all of the same problems, but does not have any new developer facing files (it actually removes one). 

cc/ @wsouto, @dickeyxxx, @tyre, @ryanb, @josevalim, @maxim, @subdigital, @steveklabnik

ATP Railties and Actionpack.
2012-12-10 16:15:04 -08:00
Rafael Mendonça França
d9039cd960 Move new CHANGELOG entry to the top 2012-12-10 17:34:35 -03:00
Rafael Mendonça França
b04fe4c539 Merge pull request #8476 from sheerun/fix/multipart-get
Prevent raising EOFError on multipart GET request.
2012-12-10 12:28:41 -08:00
Adam Stankiewicz
bc254cc235 Prevent raising EOFError on multipart GET request.
Such request can happen on Internet Explorer. When we redirect
after multipart form submission, the request type is changed
to GET, but Content-Type is preserved as multipart. GET request
cannot have multipart body and that caused Rails to fail.

It's similar fix to Rack's one:
8025a4ae94/lib/rack/request.rb (L224)
2012-12-10 21:23:59 +01:00
Jeremy Kemper
8110035623 Revert "Omit directories from gemspec.files for RubyGems 2 compat."
Obviated by rubygems/rubygems@486ed83cc8

This reverts commit bb8923dee093b615615cdfb83b34d1b0bb254f25.
2012-12-09 17:14:27 -07:00
Thiago Pinto
981900259e repeating documentation for form helpers 2012-12-09 15:24:44 -05:00
Vijay Dev
6c58fca8a9 Revert "API reader should look elsewhere for helper instructions"
This reverts commit ba2d867b2961b5ef72aad353c2d647b04654cbe3.

Reason:
ba2d867b29 (commitcomment-2276670)

[ci skip]
2012-12-09 19:29:52 +05:30
Jeremy Kemper
bb8923dee0 Omit directories from gemspec.files for RubyGems 2 compat.
RG2 packager expects each spec.files path to be a file and bombs when it tries to tarball a dir.

May revert if rubygems/rubygems#413 is accepted.
2012-12-08 17:18:46 -07:00
Vijay Dev
0a33fcd68b Merge branch 'master' of github.com:lifo/docrails 2012-12-08 23:11:37 +05:30
Francesco Rodriguez
4ec7493e3c use _action callbacks in actionmailer 2012-12-08 10:21:20 -05:00
Francesco Rodriguez
1b97d41e52 add tests to aliased _filter callbacks 2012-12-07 15:29:51 -05:00
Francesco Rodriguez
5fb94ec044 use _action instead of _filter callbacks 2012-12-07 15:24:56 -05:00
Francesco Rodriguez
a53a7bea80 update documentation and code to use _action callbacks 2012-12-07 14:46:06 -05:00
Francesco Rodriguez
f53132deea fix prepend_before_filter documentation [ci skip] 2012-12-07 14:28:32 -05:00
David Heinemeier Hansson
7b50dc5316 Fix README 2012-12-07 19:08:38 +01:00
David Heinemeier Hansson
9d62e04838 Rename all action callbacks from *_filter to *_action 2012-12-07 18:54:44 +01:00
Andrew White
af73e3cb15 Revert "Invert precedence of content in ActionDispatch::Static"
This reverts commit c59734f756b79c39486c45273d2cc5d42cd0c864.
2012-12-07 06:02:43 +00:00
Andrew White
c59734f756 Invert precedence of content in ActionDispatch::Static
This commit inverts the precedence in ActionDispatch::Static so that
dynamic content will be served before static content. This is so that
precompiled assets do not inadvertently get included when running in
development mode - it should have no effect in production where static
files are usually handled by the web server.

Closes #6421
2012-12-06 17:20:53 +00:00
Thiago Pinto
ba2d867b29 API reader should look elsewhere for helper instructions 2012-12-06 02:52:40 -05:00
Thiago Pinto
d2fb5f2ae6 complementary options guidelines for f.file_field and file_field_tag 2012-12-06 02:33:43 -05:00
Thiago Pinto
15f2663106 adding example for f.file_input 2012-12-06 02:21:15 -05:00
Thiago Pinto
4aced1f073 adding example for f.file_input 2012-12-06 02:13:33 -05:00
Thiago Pinto
7cf2912f06 correct bad jquery syntax 2012-12-06 02:05:10 -05:00
Rafael Mendonça França
6ed4ad1334 Merge pull request #8371 from freegenie/5396-conditional-fragment-caching
Allow fragment cache to accept :if and :unless options.

Closes #5396
2012-12-05 06:02:43 -08:00
Fabrizio Regini
6b014a4580 Allow fragment cache to accept :if and :unless options
[Stephen Ausman + Fabrizio Regini]
2012-12-05 14:58:38 +01:00
Rafael Mendonça França
1b32c06b99 Merge pull request #8412 from JoeyButler/action_dispatch_routing_mapper_refactoring
Extract method refactoring.
2012-12-05 05:05:40 -08:00
Joey Butler
542d525064 Extract method refactoring in ActionDispatch::Routing::SingletonResource. 2012-12-05 07:59:08 -05:00