aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/template
Commit message (Collapse)AuthorAgeFilesLines
...
* Add `Style/RedundantFreeze` to remove redudant `.freeze`Yasuo Honda2018-09-291-2/+2
| | | | | | | | | | | | | | | | | | | | | Since Rails 6.0 will support Ruby 2.4.1 or higher `# frozen_string_literal: true` magic comment is enough to make string object frozen. This magic comment is enabled by `Style/FrozenStringLiteralComment` cop. * Exclude these files not to auto correct false positive `Regexp#freeze` - 'actionpack/lib/action_dispatch/journey/router/utils.rb' - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb' It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333 Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed. * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required - 'actionpack/test/controller/test_case_test.rb' - 'activemodel/test/cases/type/string_test.rb' - 'activesupport/lib/active_support/core_ext/string/strip.rb' - 'activesupport/test/core_ext/string_ext_test.rb' - 'railties/test/generators/actions_test.rb'
* Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* Fix for variants: :any special caseJohn Hawthorn2018-09-121-1/+3
|
* Use wildcard glob for optimized template resolvingJohn Hawthorn2018-09-121-13/+51
|
* Permit list usage cleanup and clearer documentationKevin Deisz2018-08-271-6/+6
|
* Deprecate usage of ActionView::Template::Handlers::ERB::escape_whitelistKevin Deisz2018-08-241-2/+12
|
* Remove unused `MissingRequestError`yuuji.yaginuma2017-10-311-3/+0
| | | | `MissingRequestError` is no longer used since 1e2b0ce.
* Remove deprecated Erubis ERB handlerRafael Mendonça França2017-10-233-97/+0
|
* [Action View] require_relative => requireAkira Matsuda2017-10-211-1/+1
| | | | This basically reverts c4d1a4efeec6f0b5b58222993aa0bec85a19b6a8
* Use tt in doc for ActionView [ci skip]Yoshiyuki Hirano2017-08-271-3/+3
|
* Fix broken doc layout for action_view [ci skip]Yoshiyuki Hirano2017-08-274-4/+4
|
* Use frozen string literal in actionview/Kir Shatrov2017-07-2413-0/+26
|
* Merge branch 'master' into require_relative_2017Xavier Noria2017-07-021-1/+1
|\
| * Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0213-13/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-0213-0/+13
| |\ | | | | | | | | | Enforce frozen string in Rubocop
| | * Enforce frozen string in RubocopKir Shatrov2017-07-0113-0/+13
| | |
| * | Make ActionMailer frozen string literal friendly.Pat Allan2017-06-201-1/+1
| |/
* / [Action View] require => require_relativeAkira Matsuda2017-07-011-1/+1
|/
* Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-031-2/+1
|
* Add option for class_attribute default (#29270)David Heinemeier Hansson2017-05-292-10/+4
| | | | | | | | | | | | * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation
* call `gem` `erubis` before requireyuuji.yaginuma2017-02-011-0/+1
| | | | For inform that need to add `erubis` to gemfile.
* Fix inherit from deprecated `ActionView::Template::Handlers::Erubis`Fumiaki MATSUSHIMA2017-02-012-1/+10
| | | | | | | | | | There are some classes inherit from `ActionView::Template::Handlers::Erubis`. (ex. https://github.com/haml/haml/blob/4.0.7/lib/haml/helpers/safe_erubis_template.rb#L3) ``` Class.new(ActionView::Template::Handlers::Erubis) # => TypeError: superclass must be a Class (ActiveSupport::Deprecation::DeprecatedConstantProxy given) ```
* Merge pull request #27738 from kenta-s/remove-unused-argument-formatsRafael França2017-01-311-2/+2
|\ | | | | Remove unused argument `formats`
| * Remove unused argument `formats`kenta-s2017-01-201-2/+2
| |
* | Change ActionView ERB Handler from Erubis to ErubiJeremy Evans2017-01-253-72/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Erubi offers the following advantages for Rails: * Works with ruby's --enable-frozen-string-literal option * Has 88% smaller memory footprint * Does no freedom patching (Erubis adds a method to Kernel) * Has simpler internals (1 file, <150 lines of code) * Has an open development model (Erubis doesn't have a public source control repository or bug tracker) * Is not dead (Erubis hasn't been updated since 2011) Erubi is a simplified fork of Erubis that contains just the parts that are generally needed (which includes the parts that Rails uses). The only intentional difference in behavior is that it does not include support for <%=== tags for debug output. That could be added to the ActionView ERB handler if it is desired. The Erubis template handler remains in a deprecated state so that code that accesses it directly does not break. It can be removed after Rails 5.1.
* | `find_templates` should be able to handle 5 argumentskenta-s2017-01-191-2/+2
|/
* Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-1/+1
| | | | (I personally prefer writing one string in one line no matter how long it is, though)
* Privatize unneededly protected methods in Action ViewAkira Matsuda2016-12-241-2/+2
|
* No need to nodoc private methodsAkira Matsuda2016-12-241-2/+2
|
* Remove unused argumentRafael Mendonça França2016-12-021-4/+3
| | | | Now Text class is only used to render text mime type pages
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-5/+5
|
* let Regexp#match? be globally availableXavier Noria2016-10-272-2/+0
| | | | | | Regexp#match? should be considered to be part of the Ruby core library. We are emulating it for < 2.4, but not having to require the extension is part of the illusion of the emulation.
* Removed deprecated `#original_exception` in `ActionView::Template::Error`.Rafael Mendonça França2016-10-101-11/+1
|
* Merge pull request #26507 from Neodelf/actionview_duplicateRafael França2016-09-162-6/+2
|\ | | | | DRYing duplicate methods
| * DRYing duplicate methodsAndrey Molchanov2016-09-162-6/+2
| |
* | Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-5/+5
|/ | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-4/+4
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-062-79/+79
|
* modernizes hash syntax in actionviewXavier Noria2016-08-062-8/+8
|
* applies new string literal convention in actionview/libXavier Noria2016-08-067-24/+24
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* systematic revision of =~ usage in AVXavier Noria2016-07-252-3/+5
| | | | | Where appropriate, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* Change the raw template handler to render html-safe stringseileencodes2016-06-211-1/+1
| | | | | | | | | | | | | | | In PR #24929 the changelog was updated to make note that while the new template handler was changed to raw this changed the behavior when outputting plain html or js files. Previously ERB would output the files unescaped. Changing the default handler to RAW meant that these same files would be rendered as escaped rather than as js or html. Because of this change in behavior and after the discussion #24949 in we decided to change the behavior of the Raw handler to output html_safe strings by default. Now files rendered with the default handler (raw) render the file unescaped.
* keep layouts + locals from bloating the cacheAaron Patterson2016-05-171-0/+17
| | | | | | Using locals will cause layouts to be cached multiple times in the template cache. This commit removes locals from consideration when looking up the layout.
* Ensure Cache#inspect doesn't block concurrent cache writesJeremy Daer2016-04-191-0/+4
| | | | | | | Object#inspect recursively inspects instance variables, exposing all internal state, including sensitive internal cache objects. Override Cache#inspect to give a high-level summary that never interferes with concurrent cache writes.
* set in no more used in ActionView::Template::TypesGaurav Sharma2016-03-251-1/+0
| | | | | initially set is used for template type https://github.com/rails/rails/commit/67f55e28 after this commit https://github.com/rails/rails/commit/91f2ad36 it’s not require
* Support `:any` variants lookup in `PathResolver`Godfrey Chan2016-03-011-2/+6
| | | | | | | | `OptimizedFileSystemResolver` (which most Rails apps use), but did not implement the feature on the more generic `PathResolver`, which is often used in tests etc. Fixes #23881
* Lock down new `ImplicitRender` behavior for 5.0 RCGodfrey Chan2016-02-251-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Conceptually revert #20276 The feature was implemented for the `responders` gem. In the end, they did not need that feature, and have found a better fix (see plataformatec/responders#131). `ImplicitRender` is the place where Rails specifies our default policies for the case where the user did not explicitly tell us what to render, essentially describing a set of heuristics. If the gem (or the user) knows exactly what they want, they could just perform the correct `render` to avoid falling through to here, as `responders` did (the user called `respond_with`). Reverting the patch allows us to avoid exploding the complexity and defining “the fallback for a fallback” policies. 2. `respond_to` and templates are considered exhaustive enumerations If the user specified a list of formats/variants in a `respond_to` block, anything that is not explicitly included should result in an `UnknownFormat` error (which is then caught upstream to mean “406 Not Acceptable” by default). This is already how it works before this commit. Same goes for templates – if the user defined a set of templates (usually in the file system), that set is now considered exhaustive, which means that “missing” templates are considered `UnknownFormat` errors (406). 3. To keep API endpoints simple, the implicit render behavior for actions with no templates defined at all (regardless of formats, locales, variants, etc) are defaulted to “204 No Content”. This is a strictly narrower version of the feature landed in #19036 and #19377. 4. To avoid confusion when interacting in the browser, these actions will raise an `UnknownFormat` error for “interactive” requests instead. (The precise definition of “interactive” requests might change – the spirit here is to give helpful messages and avoid confusions.) Closes #20666, #23062, #23077, #23564 [Godfrey Chan, Jon Moss, Kasper Timm Hansen, Mike Clark, Matthew Draper]
* Make collection caching explicit.Kasper Timm Hansen2016-02-201-25/+0
| | | | | | | | | | | | Having collection caching that wraps templates and automatically tries to infer if they are cachable proved to be too much of a hassle. We'd rather have it be something you explicitly turn on. This removes much of the code and docs to explain the previous automatic behavior. This change also removes scoped cache keys and passing cache_options.
* WIP: Errors in logs should show log tags as well.Vipul A M2016-02-121-2/+2
| | | | | | | - Changed formatted_code_for to return array of logs to be tagged for each line - Changed some render tests to match new behaviour of return Fixes #22979
* Merge pull request #22772 from gsamokovarov/nack-template-errorDavid Heinemeier Hansson2016-02-101-0/+4
|\ | | | | Fix edge case with ActionView::Template::Error reraise