Aaron Patterson
fc4ef77d47
Merge pull request #38594 from rails/collection-refactor
...
Refactoring PartialRenderer
2020-03-23 17:41:20 -07:00
Aaron Patterson
d7bd84bc11
Remove out-of-date comments
2020-03-23 17:21:04 -07:00
Aaron Patterson
033a738817
Fix possible XSS vector in JS escape helper
...
This commit escapes dollar signs and backticks to prevent JS XSS issues
when using the `j` or `javascript_escape` helper
CVE-2020-5267
2020-03-19 09:48:08 -07:00
Joel Hawksley
c82a9193df
Document view components support ( #38656 )
2020-03-13 23:52:49 +01:00
Ryuta Kamizono
1ef8c60dfc
Avoid extra string allocation in the methods generated by eval
2020-03-10 17:43:35 +09:00
Eugene Kenny
d3599d8aff
Use index_by and index_with wherever possible
...
Using `index_by` or `index_with` is more concise than `each_with_object`
and more performant than `map { ... }.to_h` or `Hash[map { ... }]`.
2020-03-05 01:24:14 +00:00
Aaron Patterson
a15339ff65
remove usless attr_reader
2020-02-28 09:25:25 -08:00
Aaron Patterson
49adb7f4c6
pull preloading behavior in to the collection renderer
2020-02-28 09:23:22 -08:00
Aaron Patterson
72e0d04a4b
Fix issue in ActionText
...
ActionText was using `render` in a way that ActionView didn't have tests
for. This is a fix for it.
2020-02-27 16:54:50 -08:00
Aaron Patterson
232372bfd1
Merge branch 'master' into collection-refactor
...
* master:
Add a regression test that ActionText caught
[ci skip] Use yml extension for locale files
Fix `helper_method` in `ActionView::TestCase` to allow keyword arguments
Fix `delegate_missing_to` to allow keyword arguments
Dump the schema or structure of a database when calling db:migrate:name
Reset the `ActiveRecord::Base` connection after `rails db:migrate:name`
Fix `unscope` when an `eq` node which has no arel attribute
Remove unused argument
Disallow calling `connected_to` on subclasses of `ActiveRecord::Base`
More less and lazy allocation for `assign_attributes` and `_assign_attributes`
Tweak contributing_to_ruby_on_rails.md [ci skip]
Clarify the difference between (old) `spec_name` and `connection_specification_name`
Remove duplicate part from deprecation warning
Fix deprecation warnings in connection_handlers_sharding_db_test.rb
Fixup CHANGELOGs [ci skip]
`reset_column_information` does not reset @predicate_builder
Simplify FixtureResolver to reuse filtering logic
Mostly remove bad test
Use type attribute in ActionView::Helpers::JavaScriptHelper#javascript_tag example
Update some references to finder options [ci skip]
2020-02-27 16:48:15 -08:00
Aaron Patterson
5f596e299e
Add a regression test that ActionText caught
...
ActionText is using ActionView in a way that ActionView doesn't have in
it's test suite. This is just a regression test to hit that same use
case.
2020-02-27 16:47:22 -08:00
Aaron Patterson
4a4a8be064
make the cops happy
2020-02-27 15:38:20 -08:00
Aaron Patterson
8d539bde7b
Move around local variable derivation
...
This reduces object allocations in collection rendering
2020-02-27 15:01:52 -08:00
Aaron Patterson
374c1b2940
fix require
2020-02-27 14:12:09 -08:00
Aaron Patterson
78a28b7c47
always lookup template from path cache
2020-02-27 13:52:53 -08:00
Aaron Patterson
7c0dea18ce
Reduce iterations for non-homogeneous collections
...
We only need to iterate over the paths twice (this was doing it 3 times)
2020-02-27 13:20:34 -08:00
Aaron Patterson
266e34973e
Remove conditional
...
Only one case can possibly be missing a partial. We can move the cache
check to that branch and eliminate the conditional
2020-02-27 13:15:56 -08:00
Aaron Patterson
76ea105ca1
remove collection ivar
2020-02-27 13:14:09 -08:00
Aaron Patterson
a85494dc0c
Move renderers in to their own files
...
We don't need to keep all of these in the partial renderer file
2020-02-27 12:55:04 -08:00
Aaron Patterson
665a355ed8
We don't need this private method
2020-02-27 12:50:02 -08:00
Aaron Patterson
dbd8860096
move object specific stuff in to the object processing code
2020-02-27 12:49:53 -08:00
Ryuta Kamizono
4d641a3363
Fix `helper_method` in `ActionView::TestCase` to allow keyword arguments
2020-02-28 04:46:05 +09:00
Aaron Patterson
f0429dbc30
Make extracting details cheaper
...
Details are only used if the user specifies a format or local, etc when
rendering a template. This is a fairly uncommon thing to do, so lets
make it cheaper when there are no details specified
2020-02-26 17:14:37 -08:00
Aaron Patterson
2105fec017
Merging path prefixes is only done in object / collection rendering
2020-02-26 17:14:18 -08:00
Aaron Patterson
51f50a923e
path ivar is not required
2020-02-26 16:44:35 -08:00
Aaron Patterson
17fb6f0503
Move `partial_path` to ObjectRendering
...
Partial paths are only required for deriving template info for rendering
objects, which is only the case for the object renderer and the
collection renderer
2020-02-26 16:42:42 -08:00
Aaron Patterson
7210adb7ec
move locals and details ivar set in to initialize
2020-02-26 16:35:03 -08:00
Aaron Patterson
ef6e03d5b1
Move options ivar assignment in to the superclass
2020-02-26 16:33:27 -08:00
Aaron Patterson
f3dfd28821
remove extra ivar set
2020-02-26 16:19:19 -08:00
Aaron Patterson
f8f2f9ce32
remove the as_variable method
2020-02-26 16:17:49 -08:00
Aaron Patterson
f0a1548433
as: doesn't make sense without an object parameter
...
The local variable name in `as:` may not be a valid local variable name,
but if there is no object specified to be assigned to the parameter,
then why supply the `as:`? This commit adds an object for the as param
2020-02-26 16:13:12 -08:00
Aaron Patterson
9187f7482c
partial renderer is specialized for rendering partials now
2020-02-26 15:57:59 -08:00
Aaron Patterson
feec68436c
remove has_object ivar
2020-02-26 15:39:57 -08:00
Aaron Patterson
8b6c5850a5
introduce an object renderer
2020-02-26 15:37:45 -08:00
Aaron Patterson
844568c231
remove at ivar again
2020-02-26 15:06:29 -08:00
Aaron Patterson
10f7201fc5
remove more collection references from the superclass
2020-02-26 15:04:18 -08:00
Aaron Patterson
974ddb035c
remove collection references from the superclass
2020-02-26 14:59:33 -08:00
Aaron Patterson
0c1fbc7e04
collection rendering has its own class
2020-02-26 14:51:31 -08:00
Aaron Patterson
0c1d14a810
a collection is never rendered with an object
2020-02-26 08:34:03 -08:00
Aaron Patterson
6539657a3c
pull iterator allocation in to a factory method
2020-02-26 08:18:47 -08:00
Aaron Patterson
347094856c
Only iterate over collections once when a path is provided
...
We'll later reuse this object to speed up the case when a relation is
passed in.
2020-02-25 16:07:36 -08:00
Aaron Patterson
638cc381b1
rely less on the collection ivar
2020-02-25 15:17:05 -08:00
John Hawthorn
22d9b3e83e
Merge pull request #38569 from jhawthorn/simplify_fixture_resolver
...
Simplify fixture resolver
2020-02-25 14:54:17 -08:00
Aaron Patterson
5fa2c69e4b
Don't to_a things when we don't need to.
...
If the partial renderer is passed a relation or collection proxy, it
will be good for us to resolve that relation or collection proxy as late
as possible.
2020-02-25 14:42:52 -08:00
Aaron Patterson
c52fa675b8
Find the layout earlier
...
Remove duplication in finding a layout. Remove `@as` ivar.
2020-02-25 14:12:38 -08:00
Aaron Patterson
67b1a7942e
remove useless conditional
2020-02-25 13:52:45 -08:00
Aaron Patterson
7a9c90184a
variable ivar is not needed anymore
2020-02-25 13:42:05 -08:00
Aaron Patterson
99d74cac99
Don't rely on the collection ivar
...
We're going to turn this in to a more complex iterator
2020-02-25 13:33:41 -08:00
Aaron Patterson
64b3bcb0b9
block does not need to be an ivar
2020-02-25 10:26:43 -08:00
Aaron Patterson
867c4c2e60
collection with/without template are the same
2020-02-25 10:25:41 -08:00