justinfrench/formtastic — Issue #752: Magical undocumented openstruct syntax
Author: gduquesnay
Created: 2011-12-07 06:00:15+00:00
State: open

Using formtastic-ce77365b5101

We were trying to figure out how to an openstruct to set some default values. ```semantic_form_for @invitation, ... ```

where invitation is a openstruct created in the controller was giving us. "undefined method `model_name' for OpenStruct:Class"

After some research we decided to try setting the default values in the form using ```= form.input :body, :as => :text , :input_html => {:value => "some default text"}```

We added this to one field just to test it and we changed the semantic_form_for line back to using the symbol like this ```semantic_form_for :invitation, ... ```

Which was when we discovered the magic... we still had the @invitation openstruct in the controller. All the other field defaults (that we hadn't changed yet) started to work. Bug? Undocumented feature? *shrug*