Hi,
Thanks to Erol for giving me input on how to move stuff to a namespace. It meant some work, so next time I will spend more time thinking before blasting off.
I’ve stored a Form in my DB which has Elements. Below is my FormsController. All it does is show.
class FormsController < ApplicationController
def show
@form = Form.find(params[:id])
@elements = Element.find(:all, :conditions => { :form_id => @form })
respond_to do |format|
format.html # show.html.erb
end
end
end
I get stuck creating the view. It should go through all of the Form’s elements and display a label with the Element’s name, and a text field with the Element’s value.
Right now I have this:
<% form_for @form, :url => { :action => ‘create’ } do |f| %>
<%= @[form.name](http://form.name) %><% form_for(@form) do |f| %>
<% for element in @elements %>
<%= f.label_tag ‘value’, ‘name’ %>
<%= f.text_field_tag ‘value’, element.value %>
<% end %>
<%= f.submit ‘Submit’ %>
<% end %>
<% end %>
I get this error:
undefined method `label_tag’ for #ActionView::Helpers::FormBuilder:0xbcd7ee