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| %>
<fieldset>
<legend><%= @form.name %></legend>
<% 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 %>
</fieldset>
<% end %>
I get this error:
undefined method `label_tag' for #<ActionView::Helpers::FormBuilder:0xbcd7ee>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---