Skip to content

Instantly share code, notes, and snippets.

@NigelThorne
Last active December 11, 2015 12:38
Show Gist options
  • Save NigelThorne/4601963 to your computer and use it in GitHub Desktop.
Save NigelThorne/4601963 to your computer and use it in GitHub Desktop.
Problem going to Rails 3
<li class='step'>
<%= sf.hidden_field :id %>
<%= sf.hidden_field :step_definition_id %>
<%= sf.hidden_field :position ,:class=>"position"%>
<%= sf.object.format_with_params { |param| render(:partial=>'scenarios/param' , :locals=>{:param=> param, :sf=>sf})} %>
<% if sf.object.new_record? %>
<%= link_to "Remove", '#', :onclick =>"$(this).parent('.step').remove()" %>
<% else %>
<%= sf.check_box '_destroy' %>
<%= sf.label '_destroy', 'Remove' %>
<% end %>
</li>
<%
@ff = ActionView::Helpers::FormBuilder.new(:scenario, @step.scenario || Scenario.new, @template, {}, proc {} )
@sf = nil
@ff.fields_for(:steps, @step, {:child_index => @next_index}) {|sf| @sf = sf}
form = render(:partial => 'scenarios/step', :locals => { :sf=> @sf, :step => @step })
%>
$("#placeholder<%=@next_index%>").replaceWith("<%= escape_javascript form %>");
$("input/.position").each(function(index){$(this).val(index+1);});
@NigelThorne
Copy link
Author

ActionView::Template::Error (undefined method fields_for' for nil:NilClass): 2: @sf = nil 3: @fx = ActionView::Helpers::FormBuilder.new(:scenario, @step.scenario || Scenario.new, @template, {}, proc {} ) 4: @form = nil 5: @fx.send(:fields_for, :steps, @step, {:child_index => @next_index}) {|sf| 6: 7: # @form = render(:partial => 'scenarios/step', :locals => { :sf=> sf, :step => @step }) 8: } app/views/steps/new.js.erb:5:in_app_views_steps_new_js_erb___870977895_19276944'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment