$:.unshift File.expand_path("../../lib", __FILE__) require "form" require "ostruct" user = OpenStruct.new({ :name => "John Doe", :email => "john@example.org" }) # Similar to hash datasource, but using a # regular object with attributes instead. # # Form just doesn't care about datasource's type. # Just provide a object that responds to [] method # or to the attribute you want. form = Form.new(user, :user) puts form.text :name puts form.email :email