Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update CHANGELOG, README, and spec for last commit

  • Loading branch information...
commit 0a7084fe675299e1950bea7431082420d195fbc7 1 parent 755623a
Jeremy Evans authored
Showing with 17 additions and 5 deletions.
  1. +2 −0  CHANGELOG
  2. +14 −4 README.rdoc
  3. +1 −1  spec/sinatra_integration_spec.rb
2  CHANGELOG
View
@@ -1,5 +1,7 @@
=== HEAD
+* Make the Sinatra integration work on templates other than ERB/Erubis (tkellen)
+
* Add id attributes for association :as=>:radio or :as=>:checkbox fields (jeremyevans)
* Add an html class attribute for radio/checkbox labels in :as=>:radio or :as=>:checkbox fields (jeremyevans)
18 README.rdoc
View
@@ -200,11 +200,11 @@ The Forme Sequel plugin also integerates with Sequel's validation reflection sup
+validation_class_methods+ plugin that ships with Sequel. It will add +pattern+ and +maxlength+ attributes
based on the format, numericality, and length validations.
-= Sinatra ERB Support
+= Sinatra Support
Forme ships with a Sinatra extension that you can get by <tt>require "forme/sinatra"</tt> and using
-<tt>helpers Forme::Sinatra::ERB</tt> in your Sinatra::Base subclass. It allows you to use the
-following API in your Sinatra ERB forms:
+<tt>helpers Forme::Sinatra::Helper</tt> in your Sinatra::Base subclass. It allows you to use the
+following API in your Sinatra Helper forms:
<% form(@obj, :action=>'/foo') do |f| %>
<%= f.input(:field) %>
@@ -213,7 +213,17 @@ following API in your Sinatra ERB forms:
<% end %>
<% end %>
-In addition to ERB, it also works with Sinatra's Erubis support.
+This example is for ERB/Erubis, but Forme has also been reported to work with haml and slim,
+and hopefully is generic enough to work with any template library Sinatra supports.
+
+Note that if you use partials or anything that changes the @_out_buf instance variable,
+you have to reset the form's output in the partial before calling any method on the form,
+and also reset it after the partial returns:
+
+ <%= f.output = @_out_buf %>
+
+Hopefully, the integration can be made more complete in the future so that this is not
+required.
= Other Similar Projects
2  spec/sinatra_integration_spec.rb
View
@@ -6,7 +6,7 @@
require(ENV['ERUBIS'] ? 'erubis' : 'erb')
class FormeSinatraTest < Sinatra::Base
- helpers(ENV['ERUBIS'] ? Forme::Sinatra::Erubis : Forme::Sinatra::ERB)
+ helpers(Forme::Sinatra::Helper)
disable :show_exceptions
enable :raise_errors
Please sign in to comment.
Something went wrong with that request. Please try again.