Repository is archived
No commit activity in last 3 years
No release in over 3 years
Allow passing reserved words like "class", "next" etc to partials
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 5.0
~> 5.0
~> 10.0

Runtime

< 5.1, >= 3.0
 Project Readme

ActionView::Template Safe Locals

Changes ActionView::Template's render call to let you use ruby keywords as locals, so that this:

<%= render 'my_partial', class: "great" %>

Won't raise a syntax error like this:

SyntaxError (/Users/schpet/code/rails_template_components_sample/app/views/pages/_my_partial.html.erb:1: syntax error, unexpected '='
...buffer = @output_buffer;class = class = local_assigns[:class...
...                               ^):
  
app/views/pages/_my_partial.html.erb:1: syntax error, unexpected '='
app/views/pages/render_test.html.erb:15:in `_app_views_pages_render_test_html_erb__3359418883750180530_70353544330200'

Installation

Add this line to your application's Gemfile:

gem 'actionview_template_safe_locals'

And then execute:

$ bundle

License

The gem is available as open source under the terms of the MIT License.