Commit Graph

44 Commits

Author SHA1 Message Date
Jeremy Kemper
ba2d61dd81 Update tests for request memoization 2008-08-08 02:31:12 -07:00
Joshua Peek
30204c4e66 Set global ActionController::Base.view_paths for test cases 2008-07-12 14:11:51 -05:00
Michael Koziarski
2f4aaed7b3 Disable the Accept header by default
The accept header is poorly implemented by browsers and causes strange errors when used on public sites where crawlers make requests too.  You should use formatted urls (e.g. /people/1.xml) to support API clients. Alternatively to re-enable it you need to set:

config.action_controller.use_accept_header = true

A special case remains for ajax requests which will have a javascript format for the base resource (/people/1) if the X-Requested-With header is present.  This lets ajax pages still use format.js despite there being no params[:format]
2008-07-07 07:31:49 +02:00
Joshua Peek
339491a6b3 Set precompiled fixture load path constant to speed up tests 2008-06-25 15:24:12 -05:00
Pratik Naik
ef4c65088f Move missing template logic to ActionView 2008-04-19 18:59:13 +01:00
Pratik Naik
011e469410 Make MimeResponds::Responder#any work without explicit types. Closes #11140 [jaw6]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8987 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-03-07 11:17:05 +00:00
Michael Koziarski
61c90a4ad6 Reapply the TemplateFinder first applied in [8669] then reverted in [8676]. Closes #10800 [lifofifo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8683 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-21 20:45:04 +00:00
Jeremy Kemper
88bc014acc Revert r8669 for now, breaks Action Mailer. Reopens #10800.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8676 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 06:01:57 +00:00
Jeremy Kemper
84b0f9c739 Introduce TemplateFinder to handle view paths and lookups. Closes #10800.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8669 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-19 03:20:39 +00:00
Jeremy Kemper
9d755f1983 require abstract_unit directly since test is in load path
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8564 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-05 13:32:06 +00:00
David Heinemeier Hansson
9663f9952a Make sure that setting the format with a symbol works too
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8261 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-12-03 19:49:22 +00:00
Jeremy Kemper
0ee1cb2cd3 Ruby 1.9 compat, consistent load paths
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7719 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-10-02 05:32:14 +00:00
David Heinemeier Hansson
3c695356ae Fixed the layout defaults (closes #9564) [lifo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-28 01:23:20 +00:00
David Heinemeier Hansson
7ca53e1d31 Added another failing test
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7632 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-25 16:37:43 +00:00
David Heinemeier Hansson
06dd4b3166 Better failing tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7630 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-25 15:09:21 +00:00
David Heinemeier Hansson
55a9c86e62 Added failing tests for iphone
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7629 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-25 14:57:15 +00:00
David Heinemeier Hansson
501244fee4 Updated iphone_with_html_response_type to fail as it uses the new register_alias approach
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7625 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-24 23:44:36 +00:00
David Heinemeier Hansson
0d99423727 Fixed that default layouts did not take the format into account #9564 [lifofifo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7514 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-18 23:10:34 +00:00
David Heinemeier Hansson
d48039cefb Fixed that setting request.format would also affect respond_to blocks [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7479 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-09-15 04:18:32 +00:00
Jeremy Kemper
672941decb Introduce a default respond_to block for custom types. Closes #8174.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6856 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-26 03:11:34 +00:00
Jeremy Kemper
d2ed32d592 Parse url-encoded and multipart requests ourselves instead of delegating to CGI.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6764 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-05-18 06:24:50 +00:00
Rick Olson
6351e0a541 The default respond_to blocks don't set a specific extension anymore, so that both 'show.rjs' and 'show.js.rjs' will work. [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6517 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-04-12 20:25:32 +00:00
Rick Olson
e0f8342676 Change default respond_to templates for xml and rjs formats. [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6507 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-04-08 17:16:36 +00:00
Rick Olson
69b0e5c44a Allow Controllers to have multiple view_paths instead of a single template_root. Closes #2754 [John Long]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6120 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2007-02-04 20:47:05 +00:00
Jeremy Kemper
953214bd23 Remove unrelated render :yaml changes. References #4185.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5697 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-06 23:16:25 +00:00
Jeremy Kemper
91d99e2f53 More thorough JSON tests. Use application/json by default, per rfc4627. References #4185.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5695 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-06 23:06:38 +00:00
Jeremy Kemper
42596543dc respond_to recognizes JSON. render :json => @person.to_json automatically sets the content type and takes a :callback option to specify a client-side function to call using the rendered JSON as an argument. References #4185.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5694 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-06 22:27:08 +00:00
David Heinemeier Hansson
5410f2cb74 Added the option for extension aliases to mime type registration [DHH] Refactored default mime types to use the extension framework instead of just declaring themselves verbosely
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5663 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-12-02 22:48:20 +00:00
Jeremy Kemper
7ea86773a9 r5515@ks: jeremy | 2006-10-08 13:24:42 -0700
#6281
 r5516@ks:  jeremy | 2006-10-08 13:29:49 -0700
 respond_to :html doesn't assume .rhtml. Closes #6281.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5232 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-10-08 20:30:24 +00:00
Tobias Lütke
ff063d700d respond_to .html now always renders #{action_name}.rhtml so that registered custom template handlers do not override it in priority.
Custom mime types require a block and throw proper error now.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4860 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-08-30 00:34:36 +00:00
David Heinemeier Hansson
6dea52c54e Finish custom handling [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4409 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-06-02 04:38:28 +00:00
David Heinemeier Hansson
f9cd92f4ee Added interrogation of params[:format] to determine Accept type. If :format is specified and matches a declared extension, like "rss" or "xml", that mime type will be put in front of the accept handler. This means you can link to the same action from different extensions and use that fact to determine output [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4384 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-05-31 18:52:24 +00:00
David Heinemeier Hansson
c0ad3b6b68 Added test for Accept header for xml_http_request calls in functional tests (closes #4222) [agkr@pobox.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3948 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-18 21:23:14 +00:00
David Heinemeier Hansson
cc6e8ae57a Removed XML argument style for respond_to, so type.xml(object.to_xml) no longer works -- it wasnt worth the exception
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3944 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-18 21:17:14 +00:00
Jamis Buck
b2122159b1 fix broken respond_to test
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3934 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-18 17:15:22 +00:00
David Heinemeier Hansson
9840dc84f1 Allow for respond_to(:html, :js, :xml) (closes #4277) [Caio Chassot]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3919 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-18 06:43:37 +00:00
Jamis Buck
6480d49749 Add MimeResponds::Responder#any for managing multiple types with identical responses
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3876 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-15 18:27:26 +00:00
Sam Stephenson
3589871de8 Added simple alert() notifications for RJS exceptions when config.action_view.debug_rjs = true. Set debug_rjs = true for the default development environment.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3856 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-13 02:11:59 +00:00
David Heinemeier Hansson
09cec78248 Default mime type for XML should be application/xml [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3849 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-12 18:50:14 +00:00
David Heinemeier Hansson
de37f7df4f Mime types are separated by a comma, not semicolon, in the Accept header. Also switch all internal configuration of mime types away from strings and over to Mime::Type [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3847 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-12 16:03:44 +00:00
David Heinemeier Hansson
7af12d04ce Added synonym and custom type handling to respond_to [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3844 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-12 06:02:44 +00:00
David Heinemeier Hansson
9e2932f816 Assume that we accept what we give [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3843 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-12 05:13:55 +00:00
David Heinemeier Hansson
de660957a5 Added defaults to respond_to [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3842 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-12 03:39:58 +00:00
David Heinemeier Hansson
1c16649b48 Added better support for using the same actions to output for different sources depending on the Accept header [DHH] Added Base#render(:xml => xml) that works just like Base#render(:text => text), but sets the content-type to text/xml and the charset to UTF-8 [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3838 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2006-03-11 01:23:29 +00:00