Module: Ext::Og::Views

Defined in:
lib/ext/og.rb

Instance Method Summary collapse

Instance Method Details

#_form_for(entity, opts) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/ext/og.rb', line 60

def _form_for(entity, opts)
  entity = entity.new if entity.kind_of? Class
  form({:method=>:post}.merge(opts)) do
    entity.class.serializable_attributes.each do |prop|
      unless /^oid$|_oid$/.match prop.to_s
        label prop.to_s, :for=>prop; br
        input :type=>:text, :name=>prop, :value=>entity.send(prop); br
      end
    end

    input :type=>:hidden, :name=>'oid', :value=>entity.oid
    input :type=>:submit
  end
end