Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ActiveSupport::SafeBuffer objects are now automatically treated as ra…

…w in the Rails integration
  • Loading branch information...
commit f711d2bad53ae3e44d976223498a195f196cbdbe 1 parent 15dec61
@jeremyevans authored
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+=== HEAD
+
+* ActiveSupport::SafeBuffer objects are now automatically treated as raw in the Rails integration (jeremyevans)
+
=== 0.7.0 (2012-05-02)
* Support :label_position option in both of the labelers, can be set to :before or :after to override the default (jeremyevans)
View
4 lib/forme/rails.rb
@@ -1,5 +1,9 @@
require 'forme'
+class ActiveSupport::SafeBuffer
+ include Forme::Raw
+end
+
module Forme
module Rails # :nodoc:
# Subclass used when using Forme/Rails ERB integration,
View
8 spec/rails_integration_spec.rb
@@ -139,6 +139,10 @@ def combined
def noblock
render :inline => "<%= forme([:foo, :bar], {:action=>'/baz'}, :inputs=>[:first], :button=>'xyz', :legend=>'123') %>"
end
+
+ def safe_buffer
+ render :inline => "<%= forme([:foo, :bar], {:action=>'/baz'}, :inputs=>[:first], :button=>'xyz', :legend=>'<b>foo</b>'.html_safe) %>"
+ end
end
describe "Forme Rails integration" do
@@ -192,4 +196,8 @@ def o.puts(*) end
specify "#form should work without a block" do
sin_get('/noblock').should == '<form action="/baz"><fieldset class="inputs"><legend>123</legend><input id="first" name="first" type="text" value="foo"/></fieldset><input type="submit" value="xyz"/></form>'
end
+
+ specify "#form should handle Rails SafeBuffers" do
+ sin_get('/safe_buffer').should == '<form action="/baz"><fieldset class="inputs"><legend><b>foo</b></legend><input id="first" name="first" type="text" value="foo"/></fieldset><input type="submit" value="xyz"/></form>'
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.