aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/base.rb
Commit message (Collapse)AuthorAgeFilesLines
* Avoid instance variable @output_buffer not initializedSantiago Pastorino2010-05-191-1/+2
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Only run load hooks once a file has been fully loaded.Nathan Weizenbaum2010-04-271-2/+2
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* revises some <%= in rdocXavier Noria2010-04-051-1/+2
|
* Refactored url_for in AV to have its own instances of the helpers instead of ↵wycats2010-04-031-1/+6
| | | | proxying back to the controller. This potentially allows for more standalone usage of AV. It also kicked up a lot of dust in the tests, which were mocking out controllers to get this behavior. By moving it to the view, it made a lot of the tests more standalone (a win)
* Replace the placeholder base_hook API with on_load. To specify some code thatwycats2010-03-291-1/+1
| | | | | | | | should run during framework load do: ActiveSupport.on_load(:action_controller) do # Code run in the context of AC::Base end
* Move application configuration to the application configuration object, ↵José Valim2010-03-261-2/+2
| | | | remove railtie_name and engine_name and allow to set the configuration object.
* Eliminate an error from an implicit dependency on AV::Basewycats2010-03-191-21/+0
|
* Each controller class has it's own view context subclass. This removes the ↵Carlhuda2010-03-181-32/+0
| | | | need for ActionView::Base.for_controller
* All tests pass without memoizing view_contextCarlhuda2010-03-181-2/+0
|
* Use Array.wrap not Array()Jeremy Kemper2010-03-171-1/+2
|
* Modify assert_template to use notifications. Also, remove ↵Carlhuda2010-03-171-2/+7
| | | | ActionController::Base#template since it is no longer needed.
* Remove some 1.9 warnings (resulting in some fixed bugs). Remaining AM ↵wycats2010-03-171-0/+1
| | | | warnings are in dependencies.
* Do not always include the named URL helpers into AC::Base and AV::Base.Carl Lerche2010-03-161-0/+4
|
* Add deprecation notices for <% %>.Carlhuda2010-03-151-0/+3
| | | | | | | | | | | | | | | | * The approach is to compile <% %> into a method call that checks whether the value returned from a block is a String. If it is, it concats to the buffer and prints a deprecation warning. * <%= %> uses exactly the same logic to compile the template, which first checks to see whether it's compiling a block. * This should have no impact on other uses of block in templates. For instance, in <% [1,2,3].each do |i| %><%= i %><% end %>, the call to each returns an Array, not a String, so the result is not concatenated * In two cases (#capture and #cache), a String can be returned that should *never* be concatenated. We have temporarily created a String subclass called NonConcattingString which behaves (and is serialized) identically to String, but is not concatenated by the code that handles deprecated <% %> block helpers. Once we remove support for <% %> block helpers, we can remove NonConcattingString.
* Finish cleaning up rendering stack from views and move assigns evaluation to ↵José Valim2010-03-121-9/+0
| | | | controller (so plugins and/or controllers can overwrite just one method).
* Allow anything that responds to render to be given as :template and use ↵José Valim2010-03-121-1/+1
| | | | find_template instead of find in views.
* Optimize and clean up how details key get expired.José Valim2010-03-101-1/+1
|
* Clean LookupContext API.José Valim2010-03-081-1/+1
|
* Merge master.José Valim2010-03-081-0/+2
|\
| * Make many parts of Rails lazy. In order to facilitate this,wycats2010-03-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | add lazy_load_hooks.rb, which allows us to declare code that should be run at some later time. For instance, this allows us to defer requiring ActiveRecord::Base at boot time purely to apply configuration. Instead, we register a hook that should apply configuration once ActiveRecord::Base is loaded. With these changes, brings down total boot time of a new app to 300ms in production and 400ms in dev. TODO: rename base_hook
* | Speed up performance in resolvers by adding fallbacks just when required.José Valim2010-03-081-28/+18
| |
* | Rename Template::Lookup to LookupContext.José Valim2010-03-081-19/+8
| |
* | More refactoring on the views side of rendering.José Valim2010-03-081-1/+1
| |
* | Move layout lookup to views.José Valim2010-03-081-5/+1
| |
* | Added template lookup responsible to hold all information used in template ↵José Valim2010-03-071-53/+25
|/ | | | lookup.
* Tweak how ActionPack handles InheritableOptionsCarl Lerche2010-03-031-1/+1
|
* Start refactoring the method of configuring ActionViewCarlhuda2010-03-031-10/+2
|
* Delegate formats to the controllerCarlhuda2010-03-011-2/+23
|
* Renamed LocalizedCache to DetailsCache.José Valim2010-02-241-1/+1
|
* Include missing modules.José Valim2010-02-221-2/+2
|
* Convert to class_attributeJeremy Kemper2010-02-011-1/+2
|
* For performance reasons, you can no longer call html_safe! on Strings. ↵Yehuda Katz2010-01-311-1/+1
| | | | | | | | | | | | Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self). * Additionally, instead of doing concat("</form>".html_safe), you can do safe_concat("</form>"), which will skip both the flag set, and the flag check. * For the first pass, I converted virtually all #html_safe!s to #html_safe, and the tests pass. A further optimization would be to try to use #safe_concat as much as possible, reducing the performance impact if we know up front that a String is safe.
* Improve missing template error messages a little bit.José Valim2010-01-311-6/+11
|
* Fix t('.helper').José Valim2010-01-261-2/+4
|
* Make @controller an internal ivar in the viewJoshua Peek2010-01-221-8/+6
|
* Silence warningsMikel Lindsaar2010-01-021-0/+1
|
* Reorganize autoloads:Carlhuda2009-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | * A new module (ActiveSupport::Autoload) is provide that extends autoloading with new behavior. * All autoloads in modules that have extended ActiveSupport::Autoload will be eagerly required in threadsafe environments * Autoloads can optionally leave off the path if the path is the same as full_constant_name.underscore * It is possible to specify that a group of autoloads live under an additional path. For instance, all of ActionDispatch's middlewares are ActionDispatch::MiddlewareName, but they live under "action_dispatch/middlewares/middleware_name" * It is possible to specify that a group of autoloads are all found at the same path. For instance, a number of exceptions might all be declared there. * One consequence of this is that testing-related constants are not autoloaded. To get the testing helpers for a given component, require "component_name/test_case". For instance, "action_controller/test_case". * test_help.rb, which is automatically required by a Rails application's test helper, requires the test_case.rb for all active components, so this change will not be disruptive in existing or new applications.
* Extracted localized_cache.rb from ActionController, added it to ↵José Valim2009-11-011-2/+2
| | | | AbstractController and made ActionMailer use it.
* Change config implementation in AV slightlyYehuda Katz2009-10-151-1/+10
|
* Make this less brittle and work on 1.8Yehuda Katz2009-10-151-9/+9
|
* Add a read-only method which plugin authors can use to determine if xss ↵Michael Koziarski2009-10-151-0/+5
| | | | | | | escaping. This doesn't provide a way to turn off the escaping, but alternative template engine authors can figure out what their default should be by calling this. Avoids a messy version + plugin check.
* Start adding configuration to ActionView instead of using constants.Yehuda Katz2009-10-141-1/+1
| | | | | | | By using config rather than hardcoded constants, we can evolve the configuration system over time (we'd just need to update the config method with more robust capabilities and all consumers would get the capabilities with no code changes)
* Get rid of constant name usage for stack trace help in favor of overriding ↵Yehuda Katz2009-10-091-9/+9
| | | | #inspect and .name.
* Fix warning spew for 1.9Carl Lerche2009-10-081-1/+5
|
* Switch to on-by-default XSS escaping for rails.Michael Koziarski2009-10-081-1/+1
| | | | | | | | | | | | This consists of: * String#html_safe! a method to mark a string as 'safe' * ActionView::SafeBuffer a string subclass which escapes anything unsafe which is concatenated to it * Calls to String#html_safe! throughout the rails helpers * a 'raw' helper which lets you concatenate trusted HTML from non-safety-aware sources (e.g. presantized strings in the DB) * New ERB implementation based on erubis which uses a SafeBuffer instead of a String Hat tip to Django for the inspiration.
* Not calling a private method anymoreYehuda Katz2009-10-071-2/+5
|
* Fix warning spewYehuda Katz2009-10-061-1/+3
|
* Got tests to pass with some more changes.Yehuda Katz2009-08-151-1/+12
| | | | | | | | | | | | | | | | * 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".
* Clean up ActionView some:Yehuda Katz2009-08-151-16/+0
| | | | | | | | | | * 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
* Experimental: Improve performance of ActionView by preventing method cache ↵Yehuda Katz2009-08-091-13/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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.