gravityblast / web-app-theme

A simple theme for web apps
Other
2.45k stars 387 forks source link

nested attributes and haml engine #35

Open bl4d3 opened 13 years ago

bl4d3 commented 13 years ago

Hi, I was working with nested attributes (something like this http://railscasts.com/episodes/197-nested-model-form-part-2) and I had this error

undefined method `reflect_on_association' for NilClass:Class

I generated haml template with amazing gem but I figured out that into a generic new.html.haml a symbol is used into the form and this generate the error up here on this line

= link_to_add_fields "Add Zone", f, :zones

  = form_for :company, :url => companies_path, :html => { :class => :form } do |f|
    = render :partial => "form", :locals => {:f => f}

so I used this

  = form_for @company, :url => companies_path, :html => { :class => :form } do |f|

and it works fine.