Colin L. wrote in post #955669:
You can use :locals
I have tried and I evidently am missing something that is obvious to
others. The partial I am calling has this:
<%- fields_for(role_header) do |ff| -%>
<%= label role_header.class.to_s.downcase,
:rolename,
:'Role Name: ',
:class => :input_box_label,
:for => ‘input_rolename’ -%>
I have tried this:
<<%=form_for(@role, :html => {:id => :‘new_role_form’}) do |f| %>
<%=render :partial => ‘role_header’,
:locals => { ‘role_header’ => @role }-%>
And I get this:
undefined method model_name' for NilClass:Class (ActionView::Template::Error) /home/byrnejb/.rvm/gems/ruby-1.8.7-p302/gems/activemodel-3.0.1/lib/active_model/naming.rb:90:in
model_name_from_record_or_class’
I tried this:
<%=render :partial => ‘role_header’,
:locals => { :role_header => @role }-%>
And got this:
cannot fill in, no text field, text area or password field with id,
name, or label ‘Role Name’ found.
I tried this:
<%=render :partial => ‘role_header’, @role-%>
And got this:
compile error
/home/byrnejb/Software/Development/Projects/proforma.rails3/app/views/roles/new.html.erb:9:
syntax error, unexpected ‘)’, expecting tASSOC
…tial => ‘role_header’, @role);
^
/home/byrnejb/Software/Development/Projects/proforma.rails3/app/views/roles/new.html.erb:18:
syntax error, unexpected kEND, expecting ‘)’
'); end
^
/home/byrnejb/Software/Development/Projects/proforma.rails3/app/views/roles/new.html.erb:26:
syntax error, unexpected kENSURE, expecting ‘)’
I evidently have no idea how to get this to work in Rails3. So, if
anyone can see my obvious error then I would be grateful if you would be
so kind as to point it out to me.