$:.unshift File.expand_path("../../lib", __FILE__) require "form" params = { :name => "John Doe", :email => "john@example.org", :bio => "Code-addicted.\nThat's all you need to know about me." } # The first argument indicates the datasource. # In this case, we're using a simple hash. # The second argument indicates the root name # that will compose the input's name. form = Form.new(params, :user) # Just output an input[type=text]. puts form.text(:name) # Same fashion, just output an input[type=email] puts form.email(:email) # More inputs. puts form.textarea(:bio) puts form.submit(:create) # Output the label for name attribute. puts form.label(:name)