Replaces the "hash rocket" operator in favor of the newer Ruby syntax when rendering on render
This commit is contained in:
parent
c2b083df91
commit
d3e5833459
@ -70,8 +70,8 @@ def view_assigns
|
||||
|
||||
private
|
||||
# Normalize args by converting <tt>render "foo"</tt> to
|
||||
# <tt>render :action => "foo"</tt> and <tt>render "foo/bar"</tt> to
|
||||
# <tt>render :file => "foo/bar"</tt>.
|
||||
# <tt>render action: "foo"</tt> and <tt>render "foo/bar"</tt> to
|
||||
# <tt>render file: "foo/bar"</tt>.
|
||||
def _normalize_args(action = nil, options = {}) # :doc:
|
||||
if action.respond_to?(:permitted?)
|
||||
if action.permitted?
|
||||
|
@ -6,11 +6,11 @@ module RenderPartial
|
||||
class BasicController < ActionController::Base
|
||||
self.view_paths = [ActionView::FixtureResolver.new(
|
||||
"render_partial/basic/_basic.html.erb" => "BasicPartial!",
|
||||
"render_partial/basic/basic.html.erb" => "<%= @test_unchanged = 'goodbye' %><%= render :partial => 'basic' %><%= @test_unchanged %>",
|
||||
"render_partial/basic/with_json.html.erb" => "<%= render :partial => 'with_json', :formats => [:json] %>",
|
||||
"render_partial/basic/_with_json.json.erb" => "<%= render :partial => 'final', :formats => [:json] %>",
|
||||
"render_partial/basic/basic.html.erb" => "<%= @test_unchanged = 'goodbye' %><%= render partial: 'basic' %><%= @test_unchanged %>",
|
||||
"render_partial/basic/with_json.html.erb" => "<%= render partial: 'with_json', formats: [:json] %>",
|
||||
"render_partial/basic/_with_json.json.erb" => "<%= render partial: 'final', formats: [:json] %>",
|
||||
"render_partial/basic/_final.json.erb" => "{ final: json }",
|
||||
"render_partial/basic/overridden.html.erb" => "<%= @test_unchanged = 'goodbye' %><%= render :partial => 'overridden' %><%= @test_unchanged %>",
|
||||
"render_partial/basic/overridden.html.erb" => "<%= @test_unchanged = 'goodbye' %><%= render partial: 'overridden' %><%= @test_unchanged %>",
|
||||
"render_partial/basic/_overridden.html.erb" => "ParentPartial!",
|
||||
"render_partial/child/_overridden.html.erb" => "OverriddenPartial!"
|
||||
)]
|
||||
|
@ -12,8 +12,8 @@ class WithoutLayoutController < ActionController::Base
|
||||
"with_raw.html.erb" => "Hello <%=raw '<strong>this is raw</strong>' %>",
|
||||
"with_implicit_raw.html.erb" => "Hello <%== '<strong>this is also raw</strong>' %> in an html template",
|
||||
"with_implicit_raw.text.erb" => "Hello <%== '<strong>this is also raw</strong>' %> in a text template",
|
||||
"test/with_json.html.erb" => "<%= render :template => 'test/with_json', :formats => [:json] %>",
|
||||
"test/with_json.json.erb" => "<%= render :template => 'test/final', :formats => [:json] %>",
|
||||
"test/with_json.html.erb" => "<%= render template: 'test/with_json', formats: [:json] %>",
|
||||
"test/with_json.json.erb" => "<%= render template: 'test/final', formats: [:json] %>",
|
||||
"test/final.json.erb" => "{ final: json }",
|
||||
"test/with_error.html.erb" => "<%= raise 'i do not exist' %>"
|
||||
)]
|
||||
|
@ -1 +1 @@
|
||||
<%= render :partial => 'partial' %>
|
||||
<%= render partial: 'partial' %>
|
@ -1,2 +1,2 @@
|
||||
<%= render :inline => 'Some inline content' %>
|
||||
<%= render inline: 'Some inline content' %>
|
||||
<%= cache do %>Some cached content<% end %>
|
||||
|
@ -1 +1 @@
|
||||
<%= render :partial => "partial_only_html" %><%= yield %>
|
||||
<%= render partial: "partial_only_html" %><%= yield %>
|
||||
|
@ -129,8 +129,8 @@ def _process_format(format)
|
||||
lookup_context.formats = [format.to_sym] if format.to_sym
|
||||
end
|
||||
|
||||
# Normalize args by converting render "foo" to render :action => "foo" and
|
||||
# render "foo/bar" to render :template => "foo/bar".
|
||||
# Normalize args by converting render "foo" to render action: "foo" and
|
||||
# render "foo/bar" to render template: "foo/bar".
|
||||
def _normalize_args(action = nil, options = {})
|
||||
options = super(action, options)
|
||||
case action
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => 'test/partial' %>
|
||||
<%= render partial: 'test/partial' %>
|
||||
<%= yield %>
|
||||
|
@ -1 +1 @@
|
||||
<%= render :partial => "partial_only_html" %><%= yield %>
|
||||
<%= render partial: "partial_only_html" %><%= yield %>
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render :inline => 'welcome' %>
|
||||
<%= render inline: 'welcome' %>
|
||||
<%= yield %>
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => 'test/partial' %>
|
||||
<%= render partial: 'test/partial' %>
|
||||
<%= yield %>
|
||||
|
@ -1 +1 @@
|
||||
<%= render :partial => "test/second_json_partial" %>
|
||||
<%= render partial: "test/second_json_partial" %>
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => "test/json_change_priority", formats: :json %>
|
||||
HTML Template, but <%= render :partial => "test/changing_priority" %> partial
|
||||
<%= render partial: "test/json_change_priority", formats: :json %>
|
||||
HTML Template, but <%= render partial: "test/changing_priority" %> partial
|
@ -1 +1 @@
|
||||
<%= render :partial => "test/first_json_partial", formats: :json %>
|
||||
<%= render partial: "test/first_json_partial", formats: :json %>
|
@ -1 +1 @@
|
||||
<%= @test_unchanged = 'goodbye' %><%= render :partial => 'customer', :collection => @customers %><%= @test_unchanged %>
|
||||
<%= @test_unchanged = 'goodbye' %><%= render partial: 'customer', collection: @customers %><%= @test_unchanged %>
|
||||
|
@ -1,4 +1,4 @@
|
||||
First: <%= @name %>
|
||||
<%= render :partial => "person", :locals => { :name => "Stephan" } -%>
|
||||
<%= render partial: "person", locals: { name: "Stephan" } -%>
|
||||
Fourth: <%= @name %>
|
||||
Fifth: <%= name %>
|
@ -1 +1 @@
|
||||
<%= render :file => @path %>
|
||||
<%= render file: @path %>
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => 'partial', :locals => {'first' => '1'} %>
|
||||
<%= render :partial => 'partial', :locals => {'second' => '2'} %>
|
||||
<%= render partial: 'partial', locals: {'first' => '1'} %>
|
||||
<%= render partial: 'partial', locals: {'second' => '2'} %>
|
||||
|
@ -1 +1 @@
|
||||
<strong><%= render :partial => "partial_only_html" %></strong>
|
||||
<strong><%= render partial: "partial_only_html" %></strong>
|
||||
|
@ -1 +1 @@
|
||||
<strong><%= render :partial => "partial_only" %></strong>
|
||||
<strong><%= render partial: "partial_only" %></strong>
|
||||
|
@ -1 +1 @@
|
||||
**<%= render :partial => "partial_only" %>**
|
||||
**<%= render partial: "partial_only" %>**
|
||||
|
@ -1 +1 @@
|
||||
<%= render :template => "test/greeting", :formats => :xml %>
|
||||
<%= render template: "test/greeting", formats: :xml %>
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => 'test/partial' %>
|
||||
<%= render partial: 'test/partial' %>
|
||||
<%= yield %>
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => 'test/partialhtml' %>
|
||||
<%= render partial: 'test/partialhtml' %>
|
||||
<%= yield %>
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render :inline => 'welcome' %>
|
||||
<%= render inline: 'welcome' %>
|
||||
<%= yield %>
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => 'test/partial' %>
|
||||
<%= render partial: 'test/partial' %>
|
||||
<%= yield %>
|
||||
|
@ -1 +1 @@
|
||||
<%= render :partial => "test/second_json_partial" %>
|
||||
<%= render partial: "test/second_json_partial" %>
|
@ -1,4 +1,4 @@
|
||||
Before
|
||||
<%= render :partial => "test/partial" %>
|
||||
<%= render partial: "test/partial" %>
|
||||
<%= yield %>
|
||||
After
|
||||
|
2
actionview/test/fixtures/test/_one.html.erb
vendored
2
actionview/test/fixtures/test/_one.html.erb
vendored
@ -1 +1 @@
|
||||
<%= render :partial => "two" %> world
|
||||
<%= render partial: "two" %> world
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => 'test/partial', :layout => 'test/layout_for_partial', :locals => { :name => 'Bar!' } %>
|
||||
<%= render partial: 'test/partial', layout: 'test/layout_for_partial', locals: { name: 'Bar!' } %>
|
||||
partial with layout
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%= render :layout => 'test/layout_for_partial', :locals => { :name => 'Bar!' } do %>
|
||||
<%= render layout: 'test/layout_for_partial', locals: { name: 'Bar!' } do %>
|
||||
Content from inside layout!
|
||||
<% end %>
|
||||
partial with layout
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%= render :layout => 'test/layout_for_partial', :locals => { :name => 'Bar!' } do %>
|
||||
<%= render layout: 'test/layout_for_partial', locals: { name: 'Bar!' } do %>
|
||||
<%= render 'test/partial' %>
|
||||
<% end %>
|
||||
partial with layout
|
||||
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => "test/json_change_priority", formats: :json %>
|
||||
HTML Template, but <%= render :partial => "test/changing_priority" %> partial
|
||||
<%= render partial: "test/json_change_priority", formats: :json %>
|
||||
HTML Template, but <%= render partial: "test/changing_priority" %> partial
|
@ -1 +1 @@
|
||||
<%= render :partial => "test/first_json_partial", formats: :json %>
|
||||
<%= render partial: "test/first_json_partial", formats: :json %>
|
@ -1 +1 @@
|
||||
<%= render :layout => "layouts/customers" do |customer| %><%= customer.name %><% end %>
|
||||
<%= render layout: "layouts/customers" do |customer| %><%= customer.name %><% end %>
|
2
actionview/test/fixtures/test/list.erb
vendored
2
actionview/test/fixtures/test/list.erb
vendored
@ -1 +1 @@
|
||||
<%= @test_unchanged = 'goodbye' %><%= render :partial => 'customer', :collection => @customers %><%= @test_unchanged %>
|
||||
<%= @test_unchanged = 'goodbye' %><%= render partial: 'customer', collection: @customers %><%= @test_unchanged %>
|
||||
|
@ -1,3 +1,3 @@
|
||||
<% content_for :title, "title" -%>
|
||||
<% content_for :column do -%>column<% end -%>
|
||||
<%= render :layout => 'layouts/column' do -%>content<% end -%>
|
||||
<%= render layout: 'layouts/column' do -%>content<% end -%>
|
@ -1,3 +1,3 @@
|
||||
<%- content_for :header do -%>?<%- end -%>
|
||||
<%= render :template => "test/streaming" %>
|
||||
<%= render template: "test/streaming" %>
|
||||
?
|
2
actionview/test/fixtures/test/one.html.erb
vendored
2
actionview/test/fixtures/test/one.html.erb
vendored
@ -1 +1 @@
|
||||
<%= render :partial => "test/two" %> world
|
||||
<%= render partial: "test/two" %> world
|
@ -1,2 +1,2 @@
|
||||
<%= render :partial => 'partial', :locals => {'first' => '1'} %>
|
||||
<%= render :partial => 'partial', :locals => {'second' => '2'} %>
|
||||
<%= render partial: 'partial', locals: {'first' => '1'} %>
|
||||
<%= render partial: 'partial', locals: {'second' => '2'} %>
|
||||
|
@ -1 +1 @@
|
||||
<%= render :partial => "test/raise" %>
|
||||
<%= render partial: "test/raise" %>
|
2
actionview/test/fixtures/test/utf8.html.erb
vendored
2
actionview/test/fixtures/test/utf8.html.erb
vendored
@ -1,4 +1,4 @@
|
||||
Русский <%= render :partial => 'test/utf8_partial' %>
|
||||
Русский <%= render partial: 'test/utf8_partial' %>
|
||||
<%= "日".encoding %>
|
||||
<%= @output_buffer.encoding %>
|
||||
<%= __ENCODING__ %>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%# encoding: utf-8 -%>
|
||||
Русский <%= render :partial => 'test/utf8_partial_magic' %>
|
||||
Русский <%= render partial: 'test/utf8_partial_magic' %>
|
||||
<%= "日".encoding %>
|
||||
<%= @output_buffer.encoding %>
|
||||
<%= __ENCODING__ %>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%# encoding: utf-8 -%>
|
||||
Русский <%= render :partial => 'test/utf8_partial' %>
|
||||
Русский <%= render partial: 'test/utf8_partial' %>
|
||||
<%= "日".encoding %>
|
||||
<%= @output_buffer.encoding %>
|
||||
<%= __ENCODING__ %>
|
||||
|
@ -1 +1 @@
|
||||
<%= render :partial => 'missing', :formats => [:json] %>
|
||||
<%= render partial: 'missing', formats: [:json] %>
|
||||
|
@ -115,8 +115,8 @@ def test_finds_no_dependency_when_render_ends_the_name_of_another_method
|
||||
|
||||
def test_finds_dependency_on_multiline_render_calls
|
||||
template = FakeTemplate.new("<%=
|
||||
render :object => @all_posts,
|
||||
:partial => 'posts' %>", :erb)
|
||||
render object: @all_posts,
|
||||
partial: 'posts' %>", :erb)
|
||||
|
||||
tracker = make_tracker("some/_little_posts", template)
|
||||
|
||||
|
@ -82,11 +82,11 @@ class ApplicationController < ActionController::Base
|
||||
app_file "app/controllers/foo_controller.rb", <<-RUBY
|
||||
class FooController < ApplicationController
|
||||
def included_helpers
|
||||
render :inline => "<%= from_app_helper -%> <%= from_foo_helper %>"
|
||||
render inline: "<%= from_app_helper -%> <%= from_foo_helper %>"
|
||||
end
|
||||
|
||||
def not_included_helper
|
||||
render :inline => "<%= respond_to?(:from_bar_helper) -%>"
|
||||
render inline: "<%= respond_to?(:from_bar_helper) -%>"
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
|
@ -1227,11 +1227,11 @@ class Engine < ::Rails::Engine
|
||||
controller "main", <<-RUBY
|
||||
class MainController < ActionController::Base
|
||||
def foo
|
||||
render inline: '<%= render :partial => "shared/foo" %>'
|
||||
render inline: '<%= render partial: "shared/foo" %>'
|
||||
end
|
||||
|
||||
def bar
|
||||
render inline: '<%= render :partial => "shared/bar" %>'
|
||||
render inline: '<%= render partial: "shared/bar" %>'
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
@ -1308,7 +1308,7 @@ class Engine < ::Rails::Engine
|
||||
controller "main", <<-RUBY
|
||||
class MainController < ActionController::Base
|
||||
def foo
|
||||
render inline: '<%= render :partial => "shared/foo" %>'
|
||||
render inline: '<%= render partial: "shared/foo" %>'
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
|
Loading…
Reference in New Issue
Block a user