Class: SemiFormal::Form

Inherits:
Object show all
Defined in:
lib/semi_formal/form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ Form

Returns a new instance of Form.



7
8
9
# File 'lib/semi_formal/form.rb', line 7

def initialize(builder)
  @builder = builder
end

Instance Attribute Details

#builder ⇒ Object (readonly)

Returns the value of attribute builder.



3
4
5
# File 'lib/semi_formal/form.rb', line 3

def builder
  @builder
end

Instance Method Details

#action ⇒ Object



22
23
24
25
26
# File 'lib/semi_formal/form.rb', line 22

def action
  path = "/#{instance.class.model_name.plural}"
  path += "/#{instance.to_param}" unless instance.new_record?
  path
end

#attributes ⇒ Object



11
12
13
14
15
16
# File 'lib/semi_formal/form.rb', line 11

def attributes
  {
    :method => method,
    :action => action
  }
end

#method ⇒ Object



18
19
20
# File 'lib/semi_formal/form.rb', line 18

def method
  'post'
end