Ruby on Rails Wednesday, May 7, 2014

I'm using simple_fields_for but have had the same error with fields_for, my bad. simple_fields_for is from the simple form gem

On Wednesday, May 7, 2014 1:26:55 PM UTC+3, bertly_the_coder wrote:
Hi guys,

I've been coding in rails for a while now but I've never been able to render fields_for as a partial. I don't know if this is possible, as it should be dead simple. Normally when I run across this problem, I just find another way to do it.....but sadly, it's time to pay the piper....any help would be greatly appreciated.
My code looks like so:

#form.html.haml
=render partial: "html_panel_fields", locals:{f: f}
 
and my partial looks like this 
 
#_ html_panel_fields.html.haml
= f.simple_fields_for :html_panels do |o|

my error is as follows:
undefined local variable or method `f' for #<#<Class:0x007fdf7077c8e0>:0x007fdf72175738>

It looks like I have two classes embedded here......what gives?

Thanks! 
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fb3b602b-1acb-4714-ab20-9949a4809981%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment