aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/fixtures
diff options
context:
space:
mode:
authorPeter Schilling <peter@peterschilling.org>2016-09-30 10:55:38 -0700
committerPeter Schilling <peter@peterschilling.org>2016-10-02 00:21:17 -0700
commitf9960f2d74b510e0d994d49377cec36301f7e7f0 (patch)
tree82f369d688faafaaeaa559a6847dc6fee3edec5c /actionview/test/fixtures
parent72f97e281059bc983eef5bc8915e53249c623dff (diff)
downloadrails-f9960f2d74b510e0d994d49377cec36301f7e7f0.tar.gz
rails-f9960f2d74b510e0d994d49377cec36301f7e7f0.tar.bz2
rails-f9960f2d74b510e0d994d49377cec36301f7e7f0.zip
Change render to support any hash keys in locals
this lets you pass ruby keywords to templates: <%= render 'example', class: "cool" %> <%= render 'example', "spaces are" => "a-ok" %> <%= render 'example', Foo: "bar" %> Previously you'd see confusing syntax errors like this: SyntaxError (.../_example.html.erb:1: syntax error, unexpected '=' Now you can reference invalid identifiers through local_assigns. If you try to use an invalid keyword (e.g. class) in your template, you get a syntax error on the line where you use it.
Diffstat (limited to 'actionview/test/fixtures')
-rw-r--r--actionview/test/fixtures/test/render_file_inspect_local_assigns.erb1
-rw-r--r--actionview/test/fixtures/test/render_file_unicode_local.erb1
-rw-r--r--actionview/test/fixtures/test/render_file_with_ruby_keyword_locals.erb1
3 files changed, 3 insertions, 0 deletions
diff --git a/actionview/test/fixtures/test/render_file_inspect_local_assigns.erb b/actionview/test/fixtures/test/render_file_inspect_local_assigns.erb
new file mode 100644
index 0000000000..aea5c351c5
--- /dev/null
+++ b/actionview/test/fixtures/test/render_file_inspect_local_assigns.erb
@@ -0,0 +1 @@
+<%= local_assigns.inspect.html_safe %> \ No newline at end of file
diff --git a/actionview/test/fixtures/test/render_file_unicode_local.erb b/actionview/test/fixtures/test/render_file_unicode_local.erb
new file mode 100644
index 0000000000..cbfd040a76
--- /dev/null
+++ b/actionview/test/fixtures/test/render_file_unicode_local.erb
@@ -0,0 +1 @@
+<%= 🎃 %> \ No newline at end of file
diff --git a/actionview/test/fixtures/test/render_file_with_ruby_keyword_locals.erb b/actionview/test/fixtures/test/render_file_with_ruby_keyword_locals.erb
new file mode 100644
index 0000000000..7e3fe6c6d9
--- /dev/null
+++ b/actionview/test/fixtures/test/render_file_with_ruby_keyword_locals.erb
@@ -0,0 +1 @@
+The class is <%= local_assigns[:class] %> \ No newline at end of file