Commit Graph

3799 Commits

Author SHA1 Message Date
Joshua Peek
6f40139b53 SessionHash#update and SessionHash#delete are missing a call to load! [#3056 state:resolved] 2009-08-31 13:39:06 -05:00
José Valim
3f78de67b5 Ensure that blocks are also handled inside the responder. 2009-08-29 18:21:19 +02:00
José Valim
684a6b3c71 Attempt to render the template inside the responder, so it can be used for caching and pagination.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-08-29 11:01:00 -05:00
Joshua Peek
ba5995dcd9 Reset session in integration tests after changing routes to reload the middleware stack 2009-08-27 12:43:26 -05:00
Yehuda Katz
bb91beabbd Remove some old cruft 2009-08-27 05:00:57 -05:00
Carl Lerche
6a001e925e Require necessary active_support files in cookie store 2009-08-26 23:07:55 -07:00
Carl Lerche
4467fa7d24 Fixed stupid mistake... nothing to see here. 2009-08-26 20:51:54 -07:00
Carl Lerche
78ced08338 Add a default parameter for Resolver#initialize 2009-08-26 19:52:18 -07:00
Carl Lerche
2890760665 Set the request and response in ActionController::Middleware 2009-08-26 19:52:18 -07:00
Carl Lerche
efbd535f36 Have AbstractController::Logger#process_action return super's value 2009-08-26 19:52:17 -07:00
Jeffrey Hardy
05b529ca57 UrlRewriter#rewrite_url should call #to_param on the value given in :anchor option, just as #url_for does
[#2746 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 14:11:26 -07:00
Akira Matsuda
cc9af20da7 I18n: use I18n for select helpers' prompt text
[#2252 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 13:55:57 -07:00
Jeremy Kemper
a7ca5595a2 Revert "I18n: use I18n for select helpers' prompt text"
Broke CI.

[#2252 state:open]

This reverts commit adedf72821a5623227ce91e6b298838e692477e4.
2009-08-26 12:12:40 -07:00
Akira Matsuda
adedf72821 I18n: use I18n for select helpers' prompt text
[#2252 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-26 11:29:16 -07:00
Yehuda Katz
9408fcd2e8 Create new ActionController::Middleware class that will work as a normal Rack middleware.
* This initial implementation is a bit hackish, but it uses a normal middleware API
    so it's future-proof when we improve the internals.
2009-08-26 00:18:52 -07:00
Yehuda Katz + Carl Lerche
5bc66f160d And the same thing for Basic 2009-08-25 17:34:07 -07:00
Yehuda Katz + Carl Lerche
3a5269eba4 HTTP Auth should not depend on RenderingController 2009-08-25 17:29:48 -07:00
Yehuda Katz + Carl Lerche
303f9b8841 Redirector had an undeclared dependency on Logger. 2009-08-25 17:20:58 -07:00
Yehuda Katz + Carl Lerche
a21aaca8ea Rework Middleware stack to match the Rack middleware protocol more closely 2009-08-25 17:04:09 -07:00
Yehuda Katz + Carl Lerche
469424c85e Modify Digest and Basic to take a request so they can be used outside of the controller 2009-08-25 16:02:26 -07:00
Yehuda Katz + Carl Lerche
86c7b144fa Add a TODO so we remember to fix partial layouts 2009-08-25 16:02:26 -07:00
Yehuda Katz + Carl Lerche
c7ba911a43 ActionController::Metal can be a middleware 2009-08-25 12:14:31 -07:00
Joshua Peek
b58acea569 Move legacy param_parsers config onto AD::ParamsParser 2009-08-21 16:49:33 -05:00
Joshua Peek
24ad9ae3d2 Cleanup route reloading in tests. Prefer with_routing over using ActionController::Routing::Routes directly 2009-08-16 21:14:26 -05:00
Yehuda Katz
ccf28d2499 Fixes ActionMailer regression [#3059 state:resolved] 2009-08-15 20:38:50 -07:00
Jay Pignata
679128da58 Adding a call to logger from params_parser to give detailed debug information when invalid xml or json is posted
[#2481 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-15 16:51:03 -07:00
Joshua Peek
911acc10de Axe "best fit" generation support 2009-08-15 18:08:46 -05:00
Jeremy Kemper
df6617bc8a Normalize route generation order: associations, yield block, then own routes. 2009-08-15 15:56:52 -07:00
Yehuda Katz
1310231c15 Got tests to pass with some more changes.
* request.formats is much simpler now
    * For XHRs or Accept headers with a single item, we use the Accept header
    * For other requests, we use params[:format] or fallback to HTML
    * This is primarily to work around the fact that browsers provide completely
      broken Accept headers, so we have to whitelist the few cases we can
      specifically isolate and treat other requests as coming from the browser
    * For APIs, we can support single-item Accept headers, which disambiguates
      from the browsers
  * Requests to an action that only has an XML template from the browser will
    no longer find the template. This worked previously because most browsers
    provide a catch-all */*, but this was mostly accidental behavior. If you
    want to serve XML, either use the :xml format in links, or explicitly
    specify the XML template: render "template.xml".
2009-08-15 12:32:02 -07:00
Yehuda Katz
9b552fb300 Caches and cache clearing seems to actually work, but the actual architecture is kind of messy. Next: CLEAN UP. 2009-08-15 12:32:01 -07:00
Yehuda Katz
9f5cd0156a More cleanup of ActionView and reduction in need for blocks in some cases:
* only one of partial_name or :as will be available as a local
  * `object` is removed
  * Simplify _layout_for in most cases.
    * Remove <% render :partial do |args| %>
    * <% render :partial do %> still works fine
2009-08-15 12:32:01 -07:00
Yehuda Katz
27adcd1c1a Clean up ActionView some:
* Call _evaluate_assigns_and_ivars at the two entry points so we don't have to
    do a check at every render.
  * Make template.render viable without having to go through a wrapper method
  * Remove old TemplateHandler#render(template, local_assigns) path so we don't have
    to set self.template every time we render a template.
  * Move Template rescuing code to Template#render so it gets caught every time.
  * Pull in some tests from Pratik that test render @object in ActionView
2009-08-15 12:32:01 -07:00
José Valim
8692b11e81 Merge branch 'master' of git://github.com/rails/rails 2009-08-13 10:27:53 +02:00
José Valim
4f9047ecc8 Ensure collections are not treated as nested resources. 2009-08-13 10:27:41 +02:00
Yehuda Katz
4bf516e072 More perf work:
* Move #set_cookie and #delete_cookie inline to optimize. These optimizations should
    almost certainly be sent back upstream to Rack. The optimization involves using
    an ivar for cookies instead of indexing into the headers each time.
  * Was able to use a bare Hash for headers now that cookies have their own joining
    semantics (some code assumed that the raw cookies were an Array).
  * Cache blankness of body on body=
  * Improve expand_cache_key for Arrays of a single element (common in our case)
  * Use a simple layout condition check unless conditions are used
  * Cache visible actions
  * Lazily load the UrlRewriter
  * Make etag an ivar that is set on prepare!
2009-08-11 15:03:53 -07:00
Yehuda Katz
0adbeeb0c9 Got overhead down from 127 to 85. All tests pass:
* Tentatively replaced HeaderHash with SimpleHeaderHash, which does not preserve
    case but does handle converting Arrays to Strings in to_hash. This requires
    further discussion.
  * Moved default_charset to ActionDispatch::Response to avoid having to hop over
    to ActionController. Ideally, this would be a constant on AD::Response, but
    some tests expect to be able to change it dynamically and I didn't want to change
    them yet.
  * Completely override #initialize from Rack::Response. Previously, it was creating
    a HeaderHash, and then we were creating an entirely new one. There is no way to
    call super without incurring the overhead of creating a HeaderHash.
  * Override #write from Rack::Response. Its implementation tracks Content-Length,
    and doing so adds additional overhead that could be mooted if other middleware
    changes the body. It is more efficiently done at the top-level server.
  * Change sending_file to an instance_variable instead of header inspection. In
    general, if a state is important, it should be set as a property of the response
    not reconstructed later.
  * Set the Etag to @body instead of .body. AS::Cache.expand_cache_key handles
    Arrays fine, and it's more efficient to let it handle the body parts, since
    it is not forced to create a joined String.
  * If we detect the default cache control case, just set it, rather than setting
    the constituent parts and then running the normal (expensive) code to generate
    the string.
2009-08-11 15:03:53 -07:00
Yehuda Katz
9e62d6d1c0 Tentatively accept the ":as or :object, but not both" solution 2009-08-11 15:03:53 -07:00
Yehuda Katz
4945d82239 Further experimentation. Was able to cut the cost of rendering 100 partials in a collection in half.
To discuss: What are the desired semantics (if any) for layouts in a collection. There are no
  tests for it at present, and I'm not sure if it's needed at all.

  Deprecated on this branch: `object` pointing at the current object in partials. You can still
  use the partial name, or use :as to achieve the same thing. This is obviously up for discussion.
2009-08-11 15:03:53 -07:00
Yehuda Katz
02d9dd9000 Add some more caching to the lookup 2009-08-11 15:03:52 -07:00
Yehuda Katz
04d4537cd4 This change causes some failing tests, but it should be possible to make them pass with minimal performance impact. 2009-08-11 15:03:52 -07:00
codeape
8c32248acb Introduce grouped_collection_select helper.
[#1249 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 23:58:43 -07:00
Joshua Peek
734e903af5 Deprecate router generation "best match" sorting 2009-08-09 22:53:16 -05:00
Max Lapshin
0af4b0755f Make sure link_to generates the form with the specified :href if any [#2254 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 00:58:40 +01:00
Matt Duncan
920ef4e6f3 Fixed to_label_tag to accept id attribute without changing for attribute [#2660 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-09 23:54:21 +01:00
Hugo Peixoto
202b091373 Added both the documentation and a test case for the collection path name customization feature.
[#1218 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 14:26:36 -07:00
Bence Nagy
e1b73b9752 path_names could be used to customize collection actions too
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 14:26:36 -07:00
Gabe da Silveira
1185500ff0 Remove unused routeset method routes_for_controller_and_action in favour for routes_for [#3023 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 18:02:35 +01:00
Felipe Talavera
654568e71b Allow to configure trusted proxies via ActionController::Base.trusted_proxies [#2126 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 16:56:18 +01:00
rizwanreza
7dbb2b6f83 Support passing Redcloth options via textilize helper [#2973 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 16:41:09 +01:00
José Valim
32bde66aa6 Make http digest work with different server/browser combinations
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 15:53:52 +01:00
Yehuda Katz
e58b2769cf Experimental: Improve performance of ActionView by preventing method cache flushing due to runtime Kernel#extend:
* The helper module adds a new _helper_serial property onto AbstractController subclasses
  * When #helper is used to add helpers to a class, the serial number is updated
  * An ActionView subclass is created and cached based on this serial number.
    * That subclass includes the helper module from the controller
    * Subsequent requests using the same controller with the same serial will result in
      reusing that subclass, rather than being forced to take an action (like include
      or extend) that will result in a global method cache flush on MRI and a flush 
      of the entire AV class' cache on JRuby.
  * For now, this optimization is not applied to the RJS helpers, which results in
    a global method cache flush in MRI and a flush of the JavaScriptGenerator class in
    JRuby only when using RJS.
    * Since the effects are limited to using RJS, and would only affect JavaScriptGenerator
      in JRuby (as opposed to the entire view object), it seems worthwhile to apply this
      now.
  * This resulted in a significant performance improvement. I will have benchmarks
    in the next day or two that show the performance impact of the last several
    commits.
  * There is a small chance this could break existing code (although I'm not sure how).
    If that happens, please report it immediately.
2009-08-09 04:12:09 -03:00
Yehuda Katz
10eaba8f41 Cache controller_path on the AV instance to avoid needing to make additional calls back into the controller for each attempt (this was done because these calls were adding up significantly in partial rendering and showing up on profiles) 2009-08-09 04:12:09 -03:00
Yehuda Katz
e28e061165 Use response_body rather than performed? 2009-08-09 04:12:09 -03:00
Yehuda Katz
964bc4e855 Rendering a template from ActionView will default to looking for partials only in the current mime type.
* The old behavior was tested only as a side-effect of a different test--the original tests remain;
    a new template in the XML mime was added.
  * If you are relying on the current behavior and object to this change, please participate in
    http://groups.google.com/group/rubyonrails-core/browse_thread/thread/6ef25f3c108389bd
2009-08-09 04:12:08 -03:00
Yehuda Katz
33f01fb1f6 Cache some more things to improve partial perf 2009-08-09 04:12:08 -03:00
Yehuda Katz
0ab40b039b Went from 25% slower partials (vs. 2.3) to 10% faster. More to come. 2009-08-09 04:12:08 -03:00
Yehuda Katz
d7415f792c Clean up partial object some more; replace passing around a block to a single block ivar 2009-08-09 04:12:08 -03:00
Yehuda Katz
bf412c9ec6 Clean up initializer and some of the internals of PartialRenderer 2009-08-09 04:12:08 -03:00
Jeremy Kemper
b5b1576aa9 Ruby 1.9 compat: can't implicitly set instance var using block arg 2009-08-08 23:04:25 -07:00
Michael Koziarski
b97d293374 Merge branch 'patches' 2009-08-09 13:10:14 +12:00
Michael Koziarski
370bf1401a Don't call additional methods on builders passed to the atom_feed helper.
Additionally, actually test that the atom_feed helper works with :xml as an option.

[#1836 state:committed]
2009-08-09 13:10:08 +12:00
Jon Wood
271baf235d Add :redirect to the testable RJS statements [#2612 state:resolved]
Example :
  assert_select_rjs :redirect, root_path

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 02:00:15 +01:00
Jan Schwenzien
1f6afe4a74 Fix HTTP basic authentication for long credentials [#2572 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-09 01:28:43 +01:00
Steve St. Martin
618771beb5 Update truncate documentation / examples to more clearly demonstrate its actual behavior
[#3016 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-08 17:16:26 -07:00
rizwanreza
5786395760 Allow content_tag options to take an array [#1741 state:resolved] [rizwanreza, Nick Quaranto]
Example:
  content_tag('p', "limelight", :class => ["song", "play"])
  # => <p class="song play">limelight</p>

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-08 22:21:32 +01:00
José Valim
c34d6279a0 Allow radio buttons to work with booleans.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-08 18:02:07 +01:00
rizwanreza
1191e3ffaf Add :include_blank option for select_tag [#1987 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-08 17:58:27 +01:00
Niklas Holmgren
c284412b14 Polymorphic routes generates collection URL from model class [#1089 state:resolved]
Signed-off-by: Dan Pickett <dpickett@enlightsolutions.com>
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-08 17:00:29 +01:00
Yehuda Katz
ad98827a78 Merge commit 'jose/responder' 2009-08-08 12:54:02 -03:00
José Valim
6e0ac748e4 Renamed ActionController::Renderer to ActionController::Responder and ActionController::MimeResponds::Responder to ActionController::MimeResponds::Collector. 2009-08-08 17:48:07 +02:00
Yehuda Katz
efcfce50c4 Fixes "Cached fragment hit" written to log even if fragment is not cached (Erik Andrejko) [#2917 state:resolved] 2009-08-08 12:46:44 -03:00
Yehuda Katz
d0301e13f4 First pass at making partial rendering an Object. More cleanup to come. 2009-08-08 12:44:26 -03:00
Steve St. Martin
a8645593a4 remove duplicate call to stringify_keys [#2587 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2009-08-08 13:56:41 +02:00
wmoxam
98450fd168 Fix number_to_precision rounding error [#2071 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-08 02:05:10 +01:00
Jeremy Kemper
12c271d1d2 Ruby 1.9.2: implicit argument passing of super from method defined by define_method() is not supported 2009-08-07 17:04:56 -07:00
Yehuda Katz
010a0c92eb Rename find_by_parts and find_by_parts? to find and exists? 2009-08-07 15:00:12 -03:00
José Valim
aed135d3e2 Renamed presenter to renderer, added some documentation and defined its API. 2009-08-07 17:17:51 +02:00
José Valim
1fd65c80fc Encapsulate respond_with behavior in a presenter. 2009-08-07 17:16:16 +02:00
José Valim
7034272354 Add destroyed? to ActiveRecord, include tests for polymorphic urls for destroyed objects and refactor mime responds tests and documentation. 2009-08-07 17:16:16 +02:00
José Valim
f59984cc81 Add nagivational behavior to respond_with. 2009-08-07 17:16:15 +02:00
José Valim
e45e120af9 Merge branch 'master' of git://github.com/rails/rails into old 2009-08-07 17:13:44 +02:00
Yehuda Katz
bfe58ac05d Get all ActionController partial rendering to use ActionView's partial code. Consequences:
* It is not possible to always pre-determine the layout before going to ActionView.
    This was *already* broken for render :partial => @object, :layout => true. This is
    now handled by overriding render_to_body in layouts.rb and manually injecting the
    partial's response. This needs to be done in ActionController since ActionController
    knows enough to get _layout_for_option. There is probably a better abstraction here.
  * As a result, all partial rendering can correctly restrict their layouts to the mime
    type of the rendered partial. This could have previously caused a bug in some edge cases.
  * If other layout-like options are added, they might need to add special code for the
    case of render :partial. We should try to think of an alternate solution, if possible,
    but this works for the cases we know of now.
2009-08-07 11:33:54 -03:00
José Valim
dac8927b05 Merge branch 'master' of git://github.com/rails/rails into old 2009-08-07 16:10:17 +02:00
Yehuda Katz
606e950ccb Whitespace 2009-08-07 06:32:54 -03:00
Yehuda Katz
d94ba11295 Continue reworking the partial path.
* TODO: Review ActionController calling render_template for certain partials.
    Might we be able to save logic by always delegating to AV's render_partial?
2009-08-07 06:32:17 -03:00
Yehuda Katz
493d84ce2f Modify various partial methods to carry along the block that can be passed in with render
* _render_single_template, which renders a template without layout
  * _render_partial_unknown_type, which renders a partial of unknown type
    (the entry method for most partial rendering; supports strings, objects, and collections)
  * _render_partial_object, which renders a partial for a single object.
  * extracted _render_partial_path so it can be used to render the spacer without going
    through the public render :partial
2009-08-07 05:40:01 -03:00
Yehuda Katz
59e475e3a6 Some more AV work:
* rename _render_partial to _render_partial_unknown_type to reflect that for this call, 
  	we don't know the type.
  * Merge _render_partial_with_block and _render_partial_with_layout to _render_partial
    * TODO: Check to see if any more logic can be shared
    * TODO: See about streamlining block path so we can get rid of @_proc_for_layout
  * Remove @exempt_from_layout as it is no longer needed
2009-08-07 03:48:28 -03:00
Yehuda Katz
0612fd0f09 Replace _render_template_with_layout with _render_template since the layout is optional 2009-08-07 03:18:45 -03:00
Yehuda Katz
b3e199f698 Some more AV refactoring:
* remove no longer used _array_like_objects
  * _render_content_with_layout renamed to _render_content since layout it optional
  * remove check for optional layout before _render_content
2009-08-07 02:46:21 -03:00
Yehuda Katz
8534c5bf19 Start cleaning up partial path 2009-08-07 01:51:50 -03:00
Yehuda Katz
9b506484f1 This is handled by the resolver now 2009-08-07 01:51:32 -03:00
Yehuda Katz
70a440aa27 Clean up render @object a bit more. 2009-08-07 00:52:13 -03:00
Yehuda Katz
4ac9d391d3 Improve a path in _render_partial 2009-08-06 23:42:11 -03:00
Yehuda Katz
0435178ff8 Remove file that doesn't seem to be used anymore 2009-08-06 22:57:42 -03:00
Yehuda Katz
71638e6760 Move AbstractController to a top-level component 2009-08-06 22:51:24 -03:00
Yehuda Katz
16c01224cb ActionController::Metal#to_rack converted to #to_a to match normal rack convention 2009-08-06 20:05:14 -03:00
Yehuda Katz
70d779aaea Update _render_options to reflect the fact that they're public 2009-08-06 20:03:59 -03:00
Yehuda Katz
bd6b61be88 Rename /base to /metal and make base.rb and metal.rb top-level to reflect their module locations 2009-08-06 19:52:11 -03:00
Yehuda Katz
52798fd479 rename ActionController::Http to ActionController::Metal at Josh's suggestion 2009-08-06 19:50:22 -03:00
Yehuda Katz
af375a5eb3 Replace _action_view with view_context to reflect that it is public and that it does not need to be an ActionView instance 2009-08-06 19:45:40 -03:00
Yehuda Katz
f0945409d9 replace _render_*_from_controller with render_* as they are intended to be public 2009-08-06 19:43:28 -03:00
Matthew Rudy Jacobs
64268a0b06 Make sure javascript_include_tag/stylesheet_link_tag does not append ".js" or ".css" onto external urls [#1664 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-05 15:58:55 +01:00
Yehuda Katz
b53f006901 Remove legacy processing and content_length
* convert_content_type! is handled by assign_default_content_type_and_charset!
  * set_content_length! should be handled by the endpoint server. Otherwise
    each middleware that modifies the body has to do the expensive work of
    recalculating content_length.
  * convert_language! appears to be legacy. There are no tests for this
  * convert_cookies! should be handled by the new HeaderHash in Rack
  * Use an integer for .status's internal representation to avoid needing to
    do String manipulation just to find out the status
2009-08-02 19:39:33 -04:00
Yehuda Katz
503ce1d01c Update cache_control to be a Hash of options that is used to build the header.
* Significantly simplifies setting and modifying cache control in other areas
2009-08-02 19:39:33 -04:00
Sava Chankov
ec94c2550d Ruby 1.9: fix Content-Length for multibyte send_data streaming
[#2661 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-01 20:25:59 -07:00
José Valim
5b7e81efec Allow respond_with to deal with http verb accordingly. 2009-07-31 11:59:05 +02:00
José Valim
7a4a679dba Remove any resource logic from respond_to. 2009-07-30 22:43:37 +02:00
Marc Love
d860c89170 Fix tag helpers so that all HTML element boolean attributes render according to the specs. Added all boolean attributes listed in the XHTML 1.0 specs (http://www.w3.org/TR/xhtml1/guidelines.html) and HTML 5 specs (http://www.whatwg.org/specs/web-apps/current-work). HTML 5 boolean attribute rendering was broken in commit 1e2d7229602f467cfdc0ef606b5ef8a5566a1501 / [#2864 state:resolved].
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-30 09:48:27 -07:00
José Valim
d209aea7d8 Remove last TODO.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-29 12:06:04 -07:00
José Valim
fa0cf663fe Add a couple more tests to respond_with.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-29 12:06:03 -07:00
José Valim
09de34ca56 Added respond_with.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-29 12:06:03 -07:00
José Valim
bbe86077c2 Added tests for respond_to class method.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-29 12:06:03 -07:00
José Valim
67b2d08c0a Ensure that the proper accept header value is set during tests.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-29 12:06:03 -07:00
José Valim
7e280c3bff Remove Mime::ALL from Mime::SET.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-29 12:06:02 -07:00
José Valim
3e8ba616ef Refactor even more Responder. Move mime negotiation to request and added respond_to class method.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-29 12:06:02 -07:00
José Valim
3f445b316d Refactor Responder to only calculate available mime types. Those are sent to the controller that knows what to do with it (render a block or call default render).
Signed-off-by: Yehuda Katz <wycats@gmail.com>
2009-07-29 12:06:02 -07:00
Yehuda Katz
c4d1075bd3 Add support for error_messages_for(@obj) 2009-07-28 19:06:14 -07:00
Pratik Naik
e033b5d037 Merge docrails 2009-07-25 16:03:58 +01:00
Yehuda Katz
d80316ad32 First effort at new Ajax helpers 2009-07-20 16:13:21 -07:00
Yehuda Katz
f2f5cdc8bc Rename ActiveRecordHelper to ActiveModelHelper 2009-07-20 01:30:49 +09:00
Yehuda Katz
b00cac4adc Finish convert_to_object updates 2009-07-20 01:22:24 +09:00
Yehuda Katz
13e18dd940 Update some tests and add a to_model to form helpers 2009-07-20 00:58:59 +09:00
Yehuda Katz
5ffaaa71d1 Define ActiveModel API Compliance
- Define to_model on AR
  - Define to_model on ActiveModel::APICompliant
  - Update test fixtures to be API Compliant
  - Start using to_model in AP
2009-07-20 00:27:04 +09:00
Yehuda Katz
b20d68446d Move default_form_builder to ActionView so it'll work in environments not using ActionView::Base 2009-07-19 22:31:55 +09:00
Yehuda Katz
0f2914be40 Separate ActionView::Context so something else can easily be made into an AV context 2009-07-19 22:31:44 +09:00
Yehuda Katz
bb530923bc Simplify required "ActionView compliant" API 2009-07-19 21:53:02 +09:00
Yehuda Katz
1a2946a6d9 Add some missing dependencies 2009-07-15 14:16:30 -07:00
Yehuda Katz
1273ffa186 Fix AbstractController::Layouts to work when included directly on a controller 2009-07-15 14:16:12 -07:00
Yehuda Katz
28508d444e Centralize commonly used parts of AS in ActionController into action_controller.rb 2009-07-15 14:15:52 -07:00
Yehuda Katz
b0429f5e66 Rename method to a more obvious name 2009-07-11 23:40:36 -04:00
Emilio Tagua
1e2d722960 Adds a audio_tag helper for the HTML5 audio tag. Fixed video_path docs. HTML attributes values should be true or false not attribute's name. [#2864 state:resolved]
Signed-off-by: Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local>
2009-07-07 15:56:27 -07:00
Jesús García Sáez
fc6077d76e Allow symbols on routes declaration (:controller and :action values) [#2828 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-02 12:18:48 -07:00
Yehuda Katz + Carl Lerche
0fbf458b6c Removed unnecessary calls to image_path and hash lookups [#2827 state:resolved] 2009-07-02 12:14:23 -07:00
Jarl Friis
e61afed6f8 My suggestion to fix ticket 2401 [#2401 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-02 11:55:24 -07:00
Tieg Zaharia
51d7b3070c Adds a video_tag helper for the HTML5 video tag (similar to how the image_tag works) (tests included); removes a duplicate test line for image_tag; adds boolean attributes for video tag to tag()'s boolean attributes
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-02 10:36:38 -07:00
Elliot Winkler
8bb510f6c1 Patch FormTagHelper so that when a form tag is created, the div which holds the form authenticity token is set to display:inline [#2846 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-01 17:12:08 -07:00
Akira Matsuda
92bff2ebf1 Fix pattern to match various magic comment formats 2009-07-01 16:26:15 -07:00
Yehuda Katz + Carl Lerche
0515256fd3 Accept Symbol for contoller name [#2855 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-01 11:16:18 -07:00
Carl Lerche
db3de78a83 Bump up the version to 3.0.pre 2009-06-30 14:37:12 -07:00
Chris Mear
085db5e128 Make text_area_tag escape contents by default.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2015 state:committed]
2009-06-27 13:16:52 +12:00
Vicente Mundim
68b02cb00a Make filter_parameters work correctly with array parameters. 2009-06-27 12:43:57 +12:00
Christos Zisopoulos
18a97a6601 Handle missing javascript/stylesheets assets by raising an exception
An exception will be raised if a local javascript/stylesheet file included
by the stylesheet_link_tag or javascript_include_tag can not be found.

When caching is enabled, we use atomic_write to ensure that the cache file
is not created with zero length.

Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#2738 state:committed]
2009-06-26 16:47:15 +12:00
Yehuda Katz + Carl Lerche
8ee60660ce Try speeding up rails booting 2009-06-25 14:32:15 -07:00
Joshua Peek
7837da41a3 send_data should set Content-Length as a string 2009-06-25 14:47:15 -05:00
Joshua Peek
7aa730440c Remove deprecated implicit ivar assignment 2009-06-25 12:51:21 -05:00
Pratik Naik
97159fad6a Missed file from the previous commit 92b229e1251d7d3578c3f73e8185972354e76436 2009-06-25 17:03:07 +01:00
Pratik Naik
92b229e125 Make performance tests work again 2009-06-25 17:02:04 +01:00
Yehuda Katz
4417a19b03 Small changes to get 1.9 passing (for the most part) 2009-06-23 14:06:22 -07:00
=?utf-8?q?Mislav=20Marohni=C4=87?=
21cd4c0e93 Fix polymorphic_path doesn't modify options hash [#2099 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 17:53:07 +01:00
Darragh Curran
9cb8c812f2 Add content_for?(:name) helper to check if content_for(:name) is present [#1311 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 17:07:22 +01:00
Yehuda Katz + Carl Lerche
9f7eaea201 Minor ActionView cleanup 2009-06-18 12:08:50 -07:00
Yehuda Katz + Carl Lerche
497554fd10 Fix typo 2009-06-18 11:14:44 -07:00
Jeremy Kemper
5267addd4f Use errors[field] instead of errors.on(field) 2009-06-17 19:37:56 -07:00
Yehuda Katz + Carl Lerche
b4a91db441 Extract the layout proc into a method, and write documentation explaining what the proc does in various cases. 2009-06-17 18:55:10 -07:00
Yehuda Katz + Carl Lerche
ca8f8fb031 Remove one more note about deprecated behavior 2009-06-17 18:15:41 -07:00
Yehuda Katz + Carl Lerche
a9ad763c86 Drive the final stake through @content_for_*'s heart! 2009-06-17 18:08:45 -07:00
Yehuda Katz + Carl Lerche
65102c8f1a Cleaning up more tests and code that needed to work in both old and new base 2009-06-17 16:51:51 -07:00
Yehuda Katz + Carl Lerche
55ee0ba7f5 Cleaning up if defined?(ActionController::Http) blocks from the pre new base era. 2009-06-17 16:23:11 -07:00
Yehuda Katz + Carl Lerche
8fdf3d7890 Remove some defined?(Http) checks 2009-06-17 16:14:05 -07:00
Yehuda Katz + Carl Lerche
251a6e492c Rename path.rb to resolver.rb 2009-06-17 15:39:41 -07:00
Yehuda Katz + Carl Lerche
d8f352e970 Rename ActionView::Template::Path ActionView::Resolver 2009-06-17 15:32:55 -07:00
Yehuda Katz + Carl Lerche
487312515c RJS doesn't render with an HTML layout by default 2009-06-17 12:54:19 -07:00
Yehuda Katz + Carl Lerche
4fad953f90 Fixing pending tests and fixed some formats / partial rendering semantics 2009-06-17 12:54:19 -07:00
Yehuda Katz + Carl Lerche
315147fcb5 Move the exceptions for missing template into Compatibility in prep for moving it into a "not-production" module 2009-06-16 13:54:55 -07:00
Yehuda Katz + Carl Lerche
dd58f4021d An exception is raised if a layout is missing only if the layout is missing for all mimes 2009-06-16 13:44:51 -07:00
Yehuda Katz + Carl Lerche
01a4bc84b8 Exceptions now in an exceptions module 2009-06-16 11:32:38 -07:00
Yehuda Katz + Carl Lerche
a6e803bee1 Remove exceptions from AbstractUnit so they work in real life 2009-06-16 11:20:28 -07:00
Yehuda Katz + Carl Lerche
18c3b77b23 Merge process2 into process to people's regular tests run :P 2009-06-16 10:46:03 -07:00
Yehuda Katz + Carl Lerche
3c15cba175 Whoops, I guess we broke layouts ;) 2009-06-15 17:32:10 -07:00
Yehuda Katz + Carl Lerche
19c3495a67 rm -r controller/base! 2009-06-15 16:29:45 -07:00
Yehuda Katz + Carl Lerche
7b1f483fda Get all of rake tests to pass 2009-06-15 16:14:45 -07:00
Yehuda Katz + Carl Lerche
5314abed18 Keep ActionMailer using the old layouts code until it gets refactored. 2009-06-15 11:59:28 -07:00
Yehuda Katz + Carl Lerche
a63caa4c0c Get tests to run (with failures) without old base around 2009-06-15 11:44:45 -07:00
Yehuda Katz + Carl Lerche
5a8a550a45 Finish making things pass with updated internal content_type semantics 2009-06-15 11:21:08 -07:00
Joshua Peek
c50b03b754 Add :concat option to asset tag helpers to force concatenation.
This is useful for working around IE's stylesheet limit.

  stylesheet_link_tag :all, :concat => true
2009-06-15 10:23:23 -05:00
Xavier Noria
b56169c262 moves reopening of core classes to add generic stuff from Action Pack to AS/core_ext and adds tests
[#2798 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-06-13 15:01:14 -07:00
Xavier Noria
d32965399c uses Object#metaclass and Object#class_eval in a few spots
[#2797 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-06-12 16:14:06 -07:00
Andrew Kaspick
59c83af18b allow absolute paths for the asset caches
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-11 16:33:32 +12:00
Yehuda Katz + Carl Lerche
47ff57f6d1 Document and clean up HideActions and Http 2009-06-10 15:27:53 -07:00
Yehuda Katz + Carl Lerche
82a10ce9f6 Removed unnecessary code 2009-06-10 14:43:43 -07:00
Yehuda Katz + Carl Lerche
fbb6b936e9 Document ActionController::Helpers 2009-06-10 14:28:58 -07:00
Yehuda Katz + Carl Lerche
316fab7de6 Cleaned up the #default_helper_module method to make better use of #helper instead of duplicating code. 2009-06-10 14:15:21 -07:00
Yehuda Katz + Carl Lerche
4fc0778123 Simplify helper use of ActiveSupport::Dependencies, and use super better for in #helpers 2009-06-10 12:15:30 -07:00
Yehuda Katz + Carl Lerche
b6fde6b480 Clean up AbstractController::Logger and write documentation 2009-06-09 17:03:02 -07:00
Yehuda Katz + Carl Lerche
f35f47b8c0 Cleaning up and documenting AbstractController::Layouts 2009-06-09 16:47:40 -07:00
Yehuda Katz + Carl Lerche
acb2447785 Write documentation for AbstractController::Helpers 2009-06-09 16:47:39 -07:00
Stephen Anderson
a94e7d7897 Sanitized the id generated by text_area_tag helper method. text_area_tag('item[description]') should return: <textarea id="item_description" name="item[description]"></textarea> instead of: <textarea id="item[description]" name="item[description]"></textarea> The old id was causing HTML validation failures.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 20:36:45 +12:00
David Stevenson
a14df8c9b2 Made label target radio button tags with values. Radio button now respects inherited :index options when generating id.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 20:28:43 +12:00
Michael Koziarski
99803b7cdb Pull autoload fix from 2-3-stable 2009-06-09 20:10:21 +12:00
nate
f68cc639f5 A test to show that http_authentication needs to fail authentication if the password procedure returns nil. Also includes a fix to validate_digest_response to fail validation if the password procedure returns nil.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 19:47:53 +12:00
Jeremy Kemper
23f3b567e2 Uses Hash#symbolize_keys 2009-06-08 19:37:52 -07:00
Yehuda Katz + Carl Lerche
be371993b7 More documentation work on AbstractController
This is still not completely done and there might be pointers to things that don't exist yet.
2009-06-08 17:41:08 -07:00
Yehuda Katz + Carl Lerche
38b608ecab Writing comments to AbstractController 2009-06-08 16:15:14 -07:00
Yehuda Katz + Carl Lerche
a470bb3612 Remove extraneous response_obj 2009-06-08 16:15:13 -07:00
Jeremy Kemper
d3078b540e Explicitly qualify constants in BasicObjects 2009-06-08 15:07:52 -07:00
Jeremy Kemper
a6bf6f275c Use as_json instead of rails_to_json 2009-06-08 14:08:04 -07:00
Yehuda Katz + Carl Lerche
86fc43fd58 ActionPack components should no longer have undeclared dependencies.
* Tests can be run in isolation
  * Dependencies added
  * A few tests modified to avoid depending on AS deps 
    not depended on my files they were testing
2009-06-08 13:34:07 -07:00
Yehuda Katz
6b4da2ecac Add explicit requirement in a few cases it was missing.
TODO: Come up with the minimal core and remove all of these
2009-06-02 21:43:54 -07:00
Yehuda Katz
1126a85aed Further cleaning up new callbacks 2009-06-02 21:41:31 -07:00
Yehuda Katz
971e2438d9 Simplify callbacks to use less metaprogramming 2009-06-02 19:00:59 -07:00
Yehuda Katz + Carl Lerche
196f780e30 Get all the callback tests to work on new base 2009-06-01 15:40:40 -07:00
Jeremy Kemper
94911c7af7 Ensure ERB source begins with the encoding comment 2009-06-01 12:34:08 -07:00
Han Kessels
9537fd0e3a fix for IE incompatibility of :disable_with in submit_tag
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-01 14:03:52 +12:00
Jeremy Kemper
c79551f02b Depend on Hash#slice and Object#try 2009-05-30 11:59:17 -07:00
Jeremy Kemper
c53057d4fd html-scanner uses Set and class_inheritable_accessor 2009-05-30 11:59:17 -07:00
Jeremy Kemper
249d9a6606 Depend on Hash#diff extension 2009-05-30 11:59:17 -07:00
Joshua Peek
a1140a1031 Revert "Only save the session if we're actually writing to it [#2703 state:resolved]"
This reverts commit dd98280e38d640f5724887cf8a715b79f0439d2d.
2009-05-30 09:36:08 -05:00
Joshua Peek
669fd84910 AS::Concern redefines "include" to lazy include modules as dependencies 2009-05-29 17:03:23 -05:00
Joshua Peek
c7c35be8fe AS::Concern includes InstanceMethods module if it exists 2009-05-29 16:28:54 -05:00
Jeremy Kemper
5ec2c7dc29 Ruby 1.9: ERB template encoding using a magic comment at the top of the file 2009-05-28 17:12:48 -05:00
Jeremy Kemper
e23554d79e Ruby 1.9: flushing the output buffer preserves its encoding 2009-05-28 17:12:48 -05:00
Joshua Peek
4e50a35fa2 Break up DependencyModule's dual function of providing a "depend_on" DSL and "included" block DSL into separate modules. But, unify both approaches under AS::Concern. 2009-05-28 11:35:36 -05:00
Joshua Peek
de203245af Revert "Revert "Whitespace!""
This reverts commit 0cac68d3bed3e6bf8ec2eb994858e4a179046941.
2009-05-28 09:49:02 -05:00
Johan Sörensen
dd98280e38 Only save the session if we're actually writing to it [#2703 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-28 09:35:17 -05:00
Johan Sörensen
72cb6f58be The FlashHash and friends causes a lot of needless session storing, when we know for a fact that there's no content in the flash. By not storing the empty hash in the session we save a lot of communication with the various session backends, while still keeping the same interface to the flash. [#2703 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-28 09:30:49 -05:00
Olly Legg
0349278f3d Memoize cookies so that updates to cookies are available in the current request. [#2733 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-28 09:18:27 -05:00
Yehuda Katz + Carl Lerche
f2f58f5355 Fix failing ActionCacheFilter tests due to around filter changes. 2009-05-27 17:31:48 -07:00
Yehuda Katz + Carl Lerche
e70bd6bdfa Added hook point in new base #send_action which does the actual action method dispatching 2009-05-27 16:16:33 -07:00
Carl Lerche
a5688fa907 Add the ability to prepend filters to new callbacks 2009-05-27 16:15:53 -07:00
Hongli Lai (Phusion)
760cb63339 Make the default 500 Internal Server Error page more friendly. Many people don't know they're supposed to look in the log files. [#2716 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-27 15:01:03 -05:00
Eduard Bondarenko
61c471eebb Add % to RESERVED_PCHAR [#2574 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-27 14:53:05 -05:00
Niels Ganser
bb8e5843f3 ActionController::Flash::FlashHash.use now returns either the value corresponding to the passed key or itself when no key is passed [#1792 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-05-27 14:51:33 -05:00
Yehuda Katz
6bbe965ccd Reduce the cost of using ActionController::Http significantly by:
* Removing the dependency on AD::Request and AD::Response
  * Moving the logic for the request and response object
    into a new module that is included by default.
  * Changing Renderer and Redirector to use self.headers,
    self.content_type, and self.status, which have very basic
    default implementations on AC::Http. When RackConvenience
    is included (which it is by default on AC::Base), the full
    Request/Response logic is used instead of the simple logic.
2009-05-27 10:40:43 +02:00
Carl Lerche
7211048b2b Get all template tests passing on new base 2009-05-26 15:19:39 -07:00
Carl Lerche
a1f280e83d Got all the dispatch tests running on new base 2009-05-26 15:03:09 -07:00
Carl Lerche
a3ca5638d3 Get controller/test_test.rb to pass on new base 2009-05-26 14:13:35 -07:00
Carl Lerche
7dd094329e Add html-scanner to the new base set of autoloads 2009-05-26 13:40:58 -07:00
Carl Lerche
09907d1b93 Get controller/view_paths_test.rb to pass on new base 2009-05-26 12:14:50 -07:00
Carl Lerche
cbb0724f0d In new base Rails2Compatibility, move @template assignment to right before the first action is processed. 2009-05-26 12:06:48 -07:00
Pratik Naik
10085114ce Make Filter#filter work with around filters 2009-05-25 18:09:12 +02:00
Jeremy Kemper
8097da93cc Don't want Rack's Content-Type default header though 2009-05-24 19:25:53 -07:00
Jeremy Kemper
b1d4fb71bf Construct a single HeaderHash. Speed up assign_default_content_type_and_charset 2009-05-24 17:35:49 -07:00
Jeremy Kemper
6e039e863a Speed up Request#formats 2009-05-23 19:30:23 -07:00
Yehuda Katz
e0ed4b7aa4 Make a couple more tests pass.
A large number of the remaining failing tests have to do with
  the semantics of filters that are Objects. The right solution
  is probably to just implement the filter/before/after semantics
  in NewCallbacks directly (the current semantics are based
  on the old AS::Callbacks specs)
2009-05-23 01:30:25 -07:00
Yehuda Katz
e22a3d893e Slightly modify things to get content type matching working without breaking other code 2009-05-23 00:39:32 -07:00
Pratik Naik
3ac6d8f8b0 Remove unnecessary asset_host initialization 2009-05-23 02:35:34 +02:00
Pratik Naik
9286d422f8 Add asset_host to Rails2Compatibility 2009-05-23 02:29:55 +02:00
Yehuda Katz + Carl Lerche
69a1ea8b5d Created an ActionController::Renderers::All that includes all the default render options (:json, :js, :rjs, :xml) 2009-05-22 17:17:16 -07:00
Yehuda Katz + Carl Lerche
7b3fb1d43f Got controller/render_js_test.rb to pass on new base 2009-05-22 17:08:58 -07:00
Jeremy Kemper
f9dde8fe4e Port cookies to new base 2009-05-22 17:05:44 -07:00
Pratik Naik
c90f613ad6 Add Translation to the new base 2009-05-23 02:03:22 +02:00
Yehuda Katz + Carl Lerche
28dbeb3a64 Get controller/render_other_test.rb to pass on new base and fixed a bug in new base with regards to rendering layouts. 2009-05-22 16:55:27 -07:00
Pratik Naik
f766f66946 Make logging_test pass with the new base 2009-05-23 01:36:09 +02:00
Pratik Naik
8a336d01d2 Use super wherever possible in ActionController::Helpers#helper 2009-05-23 00:30:32 +02:00
Yehuda Katz + Carl Lerche
72a574b507 Get controller/layout_test.rb running on new base except for ActionController::Base.exempt_from_layout which is going to be deprecated. 2009-05-22 15:25:13 -07:00
Yehuda Katz + Carl Lerche
01129534cd Cleaned up the #render_to_body chain by extracting determining the templates to render to a separate hook point. 2009-05-22 15:24:31 -07:00
Pratik Naik
e976c489e6 Add all the existing helpers related features to the new base 2009-05-23 00:17:10 +02:00
Pratik Naik
1d168afcb1 Move FilterParameterLogging to a stand alone module and make it work on new base 2009-05-22 19:51:17 +02:00
Pratik Naik
9d08f86cd4 Make assertion tests pass with the new base 2009-05-22 19:01:52 +02:00
Jeremy Kemper
1fa7e3322d Ruby 1.9 compat: don't rely on lexical scoping since the included block is called from dependency_module 2009-05-21 20:54:28 -07:00