Ticket #480 (closed defect: duplicate)

Opened 10 months ago

Last modified 10 months ago

Form Helpers -- No Context to Take into Partials

Reported by: nickretalla..@gmail.com Assigned to:
Priority: medium Milestone: The Future
Component: Plugins Keywords:
Cc:

Description

The form helpers in merb don't have a block variable to carry their context. This seems to mean I can't put form fields into partials, because I can't pass the context along.

# views/nodes/edit.html.haml
h2= @node.name
- form_for @node, :action => url(:nod..@node) do
  = partial '/content_form'
  = submit_button "Update"

# views/_content_form.html.haml
%p= text_control :name, :label => "Title"
%p= text_area_control :text, :label => "Text"

# Results:
undefined method `name' for nil:NilClass - (NoMethodError)
/Users/nick/Code/sandyworm/app/views/nodes/edit.html.haml:3
/Users/nick/Code/sandyworm/app/views/_content_form.html.haml:1

(Notice that it didn't error on edit.html.haml:1, which means @node is clearly defined.)

Change History

02/11/08 13:25:47 changed by shayarne..@gmail.com

  • status changed from new to closed.
  • resolution set to duplicate.