Sha256: eaa2200b64427c986a58ff02e17584219e53d46c105ef9511297794d6124b551

Contents?: true

Size: 460 Bytes

Versions: 1

Compression:

Stored size: 460 Bytes

Contents

$:.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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
form-0.0.1.alpha1 examples/object.rb